From c10b131ec95efbbe34111c18c31642e5714c47df Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 26 Dec 2018 16:16:02 +0800 Subject: [PATCH] test: make sure tmpdir is created before using it Otherwise it throws ENOENT when the folder happens to be cleaned PR-URL: https://github.com/nodejs/node/pull/25224 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Richard Lau Reviewed-By: Denys Otrishko Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-child-process-spawnsync-args.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-spawnsync-args.js b/test/parallel/test-child-process-spawnsync-args.js index d8dbf9c6bd56d0..96de8670f11da5 100644 --- a/test/parallel/test-child-process-spawnsync-args.js +++ b/test/parallel/test-child-process-spawnsync-args.js @@ -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` @@ -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();