Skip to content

Commit c10b131

Browse files
joyeecheungaddaleax
authored andcommitted
test: make sure tmpdir is created before using it
Otherwise it throws ENOENT when the folder happens to be cleaned PR-URL: #25224 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1ccaf9a commit c10b131

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/parallel/test-child-process-spawnsync-args.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const tmpdir = require('../common/tmpdir');
1515
const command = common.isWindows ? 'cd' : 'pwd';
1616
const options = { cwd: tmpdir.path };
1717

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

3335
const results = testCases.map((testCase) => {
34-
const { stdout, stderr } = spawnSync(
36+
const { stdout, stderr, error } = spawnSync(
3537
command,
3638
testCase,
3739
options
3840
);
3941

42+
assert.ifError(error);
4043
assert.deepStrictEqual(stderr, Buffer.alloc(0));
4144

4245
return stdout.toString().trim().toLowerCase();

0 commit comments

Comments
 (0)