Skip to content

Commit

Permalink
test: improve assertions in child-process-execsync
Browse files Browse the repository at this point in the history
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 targos committed Aug 1, 2018
1 parent 9a88fe4 commit 3d05d82
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions test/sequential/test-child-process-execsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down

0 comments on commit 3d05d82

Please sign in to comment.