Skip to content

Commit 1d54f07

Browse files
deverickapolloMyles Borins
authored and
Myles Borins
committed
test: refactor /parallel/test-cluster-uncaught-exception.js to ES6
Replaces function expressions with ES6 arrow functions as well as improve the comparison operator to check if operands are of same types. PR-URL: #9239 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 2388648 commit 1d54f07

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

test/parallel/test-cluster-uncaught-exception.js

+10-13
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,23 @@
44
// https://github.com/joyent/node/issues/2556
55

66
const common = require('../common');
7-
var assert = require('assert');
8-
var cluster = require('cluster');
9-
var fork = require('child_process').fork;
7+
const assert = require('assert');
8+
const cluster = require('cluster');
9+
const fork = require('child_process').fork;
1010

11-
var MAGIC_EXIT_CODE = 42;
11+
const MAGIC_EXIT_CODE = 42;
1212

13-
var isTestRunner = process.argv[2] != 'child';
13+
const isTestRunner = process.argv[2] !== 'child';
1414

1515
if (isTestRunner) {
16-
var master = fork(__filename, ['child']);
17-
master.on('exit', common.mustCall(function(code) {
16+
const master = fork(__filename, ['child']);
17+
master.on('exit', common.mustCall((code) => {
1818
assert.strictEqual(code, MAGIC_EXIT_CODE);
1919
}));
2020
} else if (cluster.isMaster) {
21-
process.on('uncaughtException', function() {
22-
process.nextTick(function() {
23-
process.exit(MAGIC_EXIT_CODE);
24-
});
25-
});
26-
21+
process.on('uncaughtException', common.mustCall(() => {
22+
process.nextTick(() => process.exit(MAGIC_EXIT_CODE));
23+
}));
2724
cluster.fork();
2825
throw new Error('kill master');
2926
} else { // worker

0 commit comments

Comments
 (0)