Skip to content
Permalink
Browse files

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: #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>
  • Loading branch information...
bhavayAnand9 authored and Trott committed Jul 27, 2018
1 parent 2bdcdfc commit ede279cbdf4db5c53dcd0fe59cc47a7e5c74f842
Showing with 3 additions and 5 deletions.
  1. +3 −5 test/sequential/test-child-process-execsync.js
@@ -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);

0 comments on commit ede279c

Please sign in to comment.
You can’t perform that action at this time.