Skip to content

Commit 3d05d82

Browse files
bhavayAnand9targos
authored andcommitted
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 9a88fe4 commit 3d05d82

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

test/sequential/test-child-process-execsync.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ let caught = false;
3636
// Verify that stderr is not accessed when a bad shell is used
3737
assert.throws(
3838
function() { execSync('exit -1', { shell: 'bad_shell' }); },
39-
/spawnSync bad_shell ENOENT/,
40-
'execSync did not throw the expected exception!'
39+
/spawnSync bad_shell ENOENT/
4140
);
4241
assert.throws(
4342
function() { execFileSync('exit -1', { shell: 'bad_shell' }); },
44-
/spawnSync bad_shell ENOENT/,
45-
'execFileSync did not throw the expected exception!'
43+
/spawnSync bad_shell ENOENT/
4644
);
4745

4846
let cmd, ret;
@@ -56,7 +54,7 @@ try {
5654
} finally {
5755
assert.strictEqual(ret, undefined,
5856
`should not have a return value, received ${ret}`);
59-
assert.strictEqual(caught, true, 'execSync should throw');
57+
assert.ok(caught, 'execSync should throw');
6058
const end = Date.now() - start;
6159
assert(end < SLEEP);
6260
assert(err.status > 128 || err.signal);

0 commit comments

Comments
 (0)