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 <[email protected]>
PR-URL: #55710
Reviewed-By: LiviaMedeiros <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
juanarbol authored Nov 8, 2024
1 parent 94be10a commit 5d85b05
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 5d85b05

Please sign in to comment.