Skip to content

Commit 337aef0

Browse files
ssample812targos
authored andcommitted
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: #28193 PR-URL: #28271 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 2053dd0 commit 337aef0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

test/parallel/test-worker-process-cwd.js

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ if (!process.env.HAS_STARTED_WORKER) {
1010
if (!isMainThread) {
1111
common.skip('This test can only run as main thread');
1212
}
13+
process.chdir(__dirname);
1314
const w = new Worker(__filename);
1415
process.chdir('..');
1516
w.on('message', common.mustCall((message) => {

0 commit comments

Comments
 (0)