From 5ccce52113a0f01da474eb066ac40d2dcbea1a55 Mon Sep 17 00:00:00 2001 From: Samantha Sample Date: Mon, 17 Jun 2019 15:00:42 -0700 Subject: [PATCH] test: normalize location test-worker-process-cwd.js runs tests This change sets the process' directory to __dirname in order to normalize where the test is ran. This addresses the situation that occurs when node is located in the root, and moving up a directory results in the same directory. In that case, an error was thrown because the test interpreted this as a failed directory change. Fixes: https://github.com/nodejs/node/issues/28193 PR-URL: https://github.com/nodejs/node/pull/28271 Reviewed-By: Anna Henningsen Reviewed-By: Franziska Hinkelmann Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Rich Trott --- test/parallel/test-worker-process-cwd.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/parallel/test-worker-process-cwd.js b/test/parallel/test-worker-process-cwd.js index 81c6edac3e4501..e281610a49d1d0 100644 --- a/test/parallel/test-worker-process-cwd.js +++ b/test/parallel/test-worker-process-cwd.js @@ -10,6 +10,7 @@ if (!process.env.HAS_STARTED_WORKER) { if (!isMainThread) { common.skip('This test can only run as main thread'); } + process.chdir(__dirname); const w = new Worker(__filename); process.chdir('..'); w.on('message', common.mustCall((message) => {