Skip to content

Commit 8b161e0

Browse files
TrottMylesBorins
authored andcommitted
test: check number of message events
When a no-op message event handler is used in a test, make it clear what is expected by using `common.mustCall()` and `common.mustNotCall()`. PR-URL: #13125 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent efc0f64 commit 8b161e0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

test/parallel/test-child-process-fork-ref2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const fork = require('child_process').fork;
44

55
if (process.argv[2] === 'child') {
@@ -8,7 +8,7 @@ if (process.argv[2] === 'child') {
88

99
setTimeout(function() {
1010
console.log('child -> will this keep it alive?');
11-
process.on('message', function() { });
11+
process.on('message', common.mustNotCall());
1212
}, 400);
1313

1414
} else {

test/sequential/test-child-process-pass-fd.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if (process.argv[2] !== 'child') {
4545
// the only thing keeping this worker alive will be IPC. This is important,
4646
// because it means a worker with no parent will have no referenced handles,
4747
// thus no work to do, and will exit immediately, preventing process leaks.
48-
process.on('message', common.noop);
48+
process.on('message', common.mustCall());
4949

5050
const server = net.createServer((c) => {
5151
process.once('message', function(msg) {

0 commit comments

Comments
 (0)