Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve test coverage for child process message sending #55710

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()]);
Loading