test: make tests cwd-independent · nodejs/node@fc9e7a9 · GitHub
Skip to content

Commit fc9e7a9

Browse files
vsemozhetbytMylesBorins
authored andcommitted
test: make tests cwd-independent
PR-URL: #12812 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent fff0e39 commit fc9e7a9

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

test/doctool/test-doctool-html.js

Lines changed: 1 addition & 1 deletion

test/parallel/test-cli-eval.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,16 @@ child.exec(`${nodejs} --print "os.platform()"`,
7373
}));
7474

7575
// Module path resolve bug regression test.
76+
const cwd = process.cwd();
77+
process.chdir(path.resolve(__dirname, '../../'));
7678
child.exec(`${nodejs} --eval "require('./test/parallel/test-cli-eval.js')"`,
7779
common.mustCall((err, stdout, stderr) => {
7880
assert.strictEqual(err.code, 42);
7981
assert.strictEqual(
8082
stdout, 'Loaded as a module, exiting with status code 42.\n');
8183
assert.strictEqual(stderr, '');
8284
}));
85+
process.chdir(cwd);
8386

8487
// Missing argument should not crash.
8588
child.exec(`${nodejs} -e`, common.mustCall((err, stdout, stderr) => {

test/parallel/test-process-chdir.js

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)