diff --git a/test/parallel/test-child-process-send-type-error.js b/test/parallel/test-child-process-send-type-error.js index b92d1ee90bffaf..0cff911dc98e49 100644 --- a/test/parallel/test-child-process-send-type-error.js +++ b/test/parallel/test-child-process-send-type-error.js @@ -1,10 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); + const assert = require('assert'); const cp = require('child_process'); -function noop() {} - function fail(proc, args) { assert.throws(() => { proc.send.apply(proc, args); @@ -13,8 +12,13 @@ function fail(proc, args) { let target = process; -if (process.argv[2] !== 'child') +if (process.argv[2] !== 'child') { target = cp.fork(__filename, ['child']); + target.on('exit', common.mustCall((code, signal) => { + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); + })); +} fail(target, ['msg', null, null]); fail(target, ['msg', null, '']); @@ -22,4 +26,4 @@ fail(target, ['msg', null, 'foo']); fail(target, ['msg', null, 0]); fail(target, ['msg', null, NaN]); fail(target, ['msg', null, 1]); -fail(target, ['msg', null, null, noop]); +fail(target, ['msg', null, null, common.mustNotCall()]);