From 3d05d82353da6f3c544320e30003f457147775a5 Mon Sep 17 00:00:00 2001 From: bhavayAnand9 Date: Fri, 27 Jul 2018 18:06:28 +0530 Subject: [PATCH] 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 Reviewed-By: Rich Trott Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/sequential/test-child-process-execsync.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js index fff5b8e9f0a98b..8e4200dbe972b0 100644 --- a/test/sequential/test-child-process-execsync.js +++ b/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);