test: assert that invalidcmd throws error code
Update invalidcmd test case in test-child-process-spawn-typeerror to assert on specific expected error code. PR-URL: https://github.com/nodejs/node/pull/23942 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
parent
4f5be97e8d
commit
878f587783
@ -33,12 +33,11 @@ const invalidArgValueError =
|
|||||||
common.expectsError({ code: 'ERR_INVALID_ARG_VALUE', type: TypeError }, 14);
|
common.expectsError({ code: 'ERR_INVALID_ARG_VALUE', type: TypeError }, 14);
|
||||||
|
|
||||||
const invalidArgTypeError =
|
const invalidArgTypeError =
|
||||||
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 12);
|
common.expectsError({ code: 'ERR_INVALID_ARG_TYPE', type: TypeError }, 13);
|
||||||
|
|
||||||
assert.throws(function() {
|
assert.throws(function() {
|
||||||
const child = spawn(invalidcmd, 'this is not an array');
|
spawn(invalidcmd, 'this is not an array');
|
||||||
child.on('error', common.mustNotCall());
|
}, invalidArgTypeError);
|
||||||
}, TypeError);
|
|
||||||
|
|
||||||
// Verify that valid argument combinations do not throw.
|
// Verify that valid argument combinations do not throw.
|
||||||
spawn(cmd);
|
spawn(cmd);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user