Skip to content

Commit

Permalink
test: normalize location test-worker-process-cwd.js runs tests
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ssample812 authored and targos committed Jul 2, 2019
1 parent 2053dd0 commit 337aef0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/parallel/test-worker-process-cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 337aef0

Please sign in to comment.