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 <anna@addaleax.net> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
d5cf51dad5
commit
5ccce52113
@ -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) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user