Browse Source

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: https://github.com/nodejs/node/pull/13125
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <mhdawson@ibm.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
8b161e0a78
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 4
      test/parallel/test-child-process-fork-ref2.js
  2. 2
      test/sequential/test-child-process-pass-fd.js

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

@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const fork = require('child_process').fork;
if (process.argv[2] === 'child') {
@ -8,7 +8,7 @@ if (process.argv[2] === 'child') {
setTimeout(function() {
console.log('child -> will this keep it alive?');
process.on('message', function() { });
process.on('message', common.mustNotCall());
}, 400);
} else {

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

@ -45,7 +45,7 @@ if (process.argv[2] !== 'child') {
// the only thing keeping this worker alive will be IPC. This is important,
// because it means a worker with no parent will have no referenced handles,
// thus no work to do, and will exit immediately, preventing process leaks.
process.on('message', common.noop);
process.on('message', common.mustCall());
const server = net.createServer((c) => {
process.once('message', function(msg) {

Loading…
Cancel
Save