summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-uncaught-exception.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-cluster-uncaught-exception.js')
-rw-r--r--test/parallel/test-cluster-uncaught-exception.js14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/parallel/test-cluster-uncaught-exception.js b/test/parallel/test-cluster-uncaught-exception.js
index 1f04b71f01..1091b6fec7 100644
--- a/test/parallel/test-cluster-uncaught-exception.js
+++ b/test/parallel/test-cluster-uncaught-exception.js
@@ -3,7 +3,7 @@
// one that the cluster module installs.
// https://github.com/joyent/node/issues/2556
-require('../common');
+const common = require('../common');
var assert = require('assert');
var cluster = require('cluster');
var fork = require('child_process').fork;
@@ -13,16 +13,10 @@ var MAGIC_EXIT_CODE = 42;
var isTestRunner = process.argv[2] != 'child';
if (isTestRunner) {
- var exitCode = -1;
-
- process.on('exit', function() {
- assert.equal(exitCode, MAGIC_EXIT_CODE);
- });
-
var master = fork(__filename, ['child']);
- master.on('exit', function(code) {
- exitCode = code;
- });
+ master.on('exit', common.mustCall(function(code) {
+ assert.strictEqual(code, MAGIC_EXIT_CODE);
+ }));
} else if (cluster.isMaster) {
process.on('uncaughtException', function() {
process.nextTick(function() {