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]>
  • Loading branch information
juanarbol committed Nov 4, 2024
1 parent 8807549 commit d99344a
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
@@ -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()]);

0 comments on commit d99344a

Please sign in to comment.