Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
drewfish committed Nov 28, 2018
commit 6c7bd3810a359c8e59178afec343b149ceeb57c3
5 changes: 3 additions & 2 deletions test/parallel/test-fs-error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,11 @@ function re(literals, ...values) {
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(
() => fs.renameSync(nonexistentFile, 'foo'),
() => fs.renameSync(nonexistentFile, destFile),
validateError
);
}
Expand Down