test: validate fs.rename() when NODE_TEST_DIR on separate mount
When testing fs.rename() of an non-existent file, use a destination path which is in the same directory. Otherwise we might trigger an `EXDEV` error if NODE_TEST_DIR is a separate device than the current working directory. Fixes: https://github.com/nodejs/node/issues/21669 PR-URL: https://github.com/nodejs/node/pull/24707 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
64cea5a1ac
commit
8344f24581
@ -299,10 +299,11 @@ function re(literals, ...values) {
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
fs.rename(nonexistentFile, 'foo', common.mustCall(validateError));
|
const destFile = path.join(tmpdir.path, 'foo');
|
||||||
|
fs.rename(nonexistentFile, destFile, common.mustCall(validateError));
|
||||||
|
|
||||||
assert.throws(
|
assert.throws(
|
||||||
() => fs.renameSync(nonexistentFile, 'foo'),
|
() => fs.renameSync(nonexistentFile, destFile),
|
||||||
validateError
|
validateError
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user