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: nodejs#28193
  • Loading branch information
ssample812 committed Jun 17, 2019
1 parent 2a9f1ad commit 484814b
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 484814b

Please sign in to comment.