• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3// Test fails in Node v5.4.0 and passes in v5.4.1 and newer.
4
5const common = require('../common');
6const net = require('net');
7const cluster = require('cluster');
8
9cluster.schedulingPolicy = cluster.SCHED_NONE;
10
11if (cluster.isMaster) {
12  const worker = cluster.fork();
13
14  // This is the important part of the test: Confirm that `disconnect` fires.
15  worker.on('disconnect', common.mustCall());
16
17  // These are just some extra stuff we're checking for good measure...
18  worker.on('exit', common.mustCall());
19  cluster.on('exit', common.mustCall());
20
21  cluster.disconnect();
22  return;
23}
24
25const server = net.createServer();
26
27server.listen(0);
28