Skip to content

Commit 85e9487

Browse files
drewfishBethGriggs
authored andcommitted
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: #21669 PR-URL: #24707 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 5966dbe commit 85e9487

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

test/parallel/test-fs-error-messages.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -289,10 +289,11 @@ function re(literals, ...values) {
289289
return true;
290290
};
291291

292-
fs.rename(nonexistentFile, 'foo', common.mustCall(validateError));
292+
const destFile = path.join(tmpdir.path, 'foo');
293+
fs.rename(nonexistentFile, destFile, common.mustCall(validateError));
293294

294295
assert.throws(
295-
() => fs.renameSync(nonexistentFile, 'foo'),
296+
() => fs.renameSync(nonexistentFile, destFile),
296297
validateError
297298
);
298299
}

0 commit comments

Comments
 (0)