Skip to content

Commit

Permalink
test: make sure tmpdir is created before using it
Browse files Browse the repository at this point in the history
Otherwise it throws ENOENT when the folder happens to be cleaned

PR-URL: #25224
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Denys Otrishko <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
joyeecheung authored and addaleax committed Jan 5, 2019
1 parent 1ccaf9a commit c10b131
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/parallel/test-child-process-spawnsync-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const tmpdir = require('../common/tmpdir');
const command = common.isWindows ? 'cd' : 'pwd';
const options = { cwd: tmpdir.path };

tmpdir.refresh();

if (common.isWindows) {
// This test is not the case for Windows based systems
// unless the `shell` options equals to `true`
Expand All @@ -31,12 +33,13 @@ const testCases = [
const expectedResult = tmpdir.path.trim().toLowerCase();

const results = testCases.map((testCase) => {
const { stdout, stderr } = spawnSync(
const { stdout, stderr, error } = spawnSync(
command,
testCase,
options
);

assert.ifError(error);
assert.deepStrictEqual(stderr, Buffer.alloc(0));

return stdout.toString().trim().toLowerCase();
Expand Down

0 comments on commit c10b131

Please sign in to comment.