mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
test: improve test coverage for child process message sending
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: https://github.com/nodejs/node/pull/55710 Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
94be10ac32
commit
5d85b056ed
@ -4,10 +4,10 @@ const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const cp = require('child_process');
|
||||
|
||||
function fail(proc, args) {
|
||||
function fail(proc, args, code = 'ERR_INVALID_ARG_TYPE') {
|
||||
assert.throws(() => {
|
||||
proc.send.apply(proc, args);
|
||||
}, { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError' });
|
||||
}, { code, name: 'TypeError' });
|
||||
}
|
||||
|
||||
let target = process;
|
||||
@ -25,5 +25,6 @@ fail(target, ['msg', null, '']);
|
||||
fail(target, ['msg', null, 'foo']);
|
||||
fail(target, ['msg', null, 0]);
|
||||
fail(target, ['msg', null, NaN]);
|
||||
fail(target, ['msg', 'meow', undefined], 'ERR_INVALID_HANDLE_TYPE');
|
||||
fail(target, ['msg', null, 1]);
|
||||
fail(target, ['msg', null, null, common.mustNotCall()]);
|
||||
|
Loading…
Reference in New Issue
Block a user