Skip to content

Commit

Permalink
test: improve test coverage for child process message sending
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #55710
Reviewed-By: LiviaMedeiros <livia@cirno.name>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
juanarbol authored and aduh95 committed Nov 16, 2024
1 parent 3a9733c commit 84c4747
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/parallel/test-child-process-send-type-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()]);

0 comments on commit 84c4747

Please sign in to comment.