From 8344f2458111904ad1de4ce08ffd9b4360ce81ed Mon Sep 17 00:00:00 2001 From: Drew Folta Date: Wed, 28 Nov 2018 12:55:36 -0800 Subject: [PATCH] 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 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- test/parallel/test-fs-error-messages.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-fs-error-messages.js b/test/parallel/test-fs-error-messages.js index 96ff606cccec4e..dd5438c44bfce9 100644 --- a/test/parallel/test-fs-error-messages.js +++ b/test/parallel/test-fs-error-messages.js @@ -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 ); }