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 <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>
1 parent efc0f64 commit 8b161e0

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
constcommon=require('../common');
33
constfork=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‎

Lines changed: 1 addition & 1 deletion
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
constserver=net.createServer((c)=>{
5151
process.once('message',function(msg){

0 commit comments

Comments
 (0)