0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-regress-GH-3238.js
James M Snell eaaec57332 test: use worker.exitedAfterDisconnect consistently
PR-URL: https://github.com/nodejs/node/pull/13702
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
2017-06-20 11:48:42 -07:00

23 lines
570 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
if (cluster.isMaster) {
function forkWorker(action) {
const worker = cluster.fork({ action });
worker.on('disconnect', common.mustCall(() => {
assert.strictEqual(worker.exitedAfterDisconnect, true);
}));
worker.on('exit', common.mustCall(() => {
assert.strictEqual(worker.exitedAfterDisconnect, true);
}));
}
forkWorker('disconnect');
forkWorker('kill');
} else {
cluster.worker[process.env.action]();
}