test: improve assertions in child-process-execsync

Improve assertions in test-child-process-execsync by removing unneeded
third arguments and replacing equal checks with assert.ok() where
appropriate.

PR-URL: https://github.com/nodejs/node/pull/22016
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
bhavayAnand9 2018-07-27 18:06:28 +05:30 committed by Rich Trott
parent 2bdcdfc3cb
commit ede279cbdf

View File

@ -36,13 +36,11 @@ let caught = false;
// Verify that stderr is not accessed when a bad shell is used
assert.throws(
function() { execSync('exit -1', { shell: 'bad_shell' }); },
/spawnSync bad_shell ENOENT/,
'execSync did not throw the expected exception!'
/spawnSync bad_shell ENOENT/
);
assert.throws(
function() { execFileSync('exit -1', { shell: 'bad_shell' }); },
/spawnSync bad_shell ENOENT/,
'execFileSync did not throw the expected exception!'
/spawnSync bad_shell ENOENT/
);
let cmd, ret;
@ -56,7 +54,7 @@ try {
} finally {
assert.strictEqual(ret, undefined,
`should not have a return value, received ${ret}`);
assert.strictEqual(caught, true, 'execSync should throw');
assert.ok(caught, 'execSync should throw');
const end = Date.now() - start;
assert(end < SLEEP);
assert(err.status > 128 || err.signal);