node/test/parallel/test-cluster-setup-master-emit.js
cjihrig ff1efa6087 test: use const for all require() calls
PR-URL: https://github.com/nodejs/node/pull/10550
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-01-02 18:28:18 -05:00

27 lines
649 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');
assert(cluster.isMaster);
function emitAndCatch(next) {
cluster.once('setup', common.mustCall(function(settings) {
assert.strictEqual(settings.exec, 'new-exec');
setImmediate(next);
}));
cluster.setupMaster({ exec: 'new-exec' });
}
function emitAndCatch2(next) {
cluster.once('setup', common.mustCall(function(settings) {
assert('exec' in settings);
setImmediate(next);
}));
cluster.setupMaster();
}
emitAndCatch(common.mustCall(function() {
emitAndCatch2(common.mustCall(function() {}));
}));