mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
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>
25 lines
558 B
JavaScript
25 lines
558 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const fork = require('child_process').fork;
|
|
|
|
if (process.argv[2] === 'child') {
|
|
console.log('child -> call disconnect');
|
|
process.disconnect();
|
|
|
|
setTimeout(function() {
|
|
console.log('child -> will this keep it alive?');
|
|
process.on('message', common.mustNotCall());
|
|
}, 400);
|
|
|
|
} else {
|
|
const child = fork(__filename, ['child']);
|
|
|
|
child.on('disconnect', function() {
|
|
console.log('parent -> disconnect');
|
|
});
|
|
|
|
child.once('exit', function() {
|
|
console.log('parent -> exit');
|
|
});
|
|
}
|