From 5861135ddb3a068d42b7bae0b9b4a852d0815f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9?= Date: Fri, 8 Nov 2024 11:32:30 -0500 Subject: [PATCH] test: improve test coverage for child process message sending MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juan José Arboleda PR-URL: https://github.com/nodejs/node/pull/55710 Reviewed-By: LiviaMedeiros Reviewed-By: Antoine du Hamel --- test/parallel/test-child-process-send-type-error.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-child-process-send-type-error.js b/test/parallel/test-child-process-send-type-error.js index 65c620dd29b3d2..91136cd03179fa 100644 --- a/test/parallel/test-child-process-send-type-error.js +++ b/test/parallel/test-child-process-send-type-error.js @@ -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()]);