diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js index 99573ef9539f56..08d0cd3e080759 100644 --- a/test/parallel/test-cluster-shared-handle-bind-error.js +++ b/test/parallel/test-cluster-shared-handle-bind-error.js @@ -1,25 +1,26 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { // Master opens and binds the socket and shares it with the worker. cluster.schedulingPolicy = cluster.SCHED_NONE; // Hog the TCP port so that when the worker tries to bind, it'll fail. - net.createServer(common.fail).listen(common.PORT, function() { - var server = this; - var worker = cluster.fork(); - worker.on('exit', common.mustCall(function(exitCode) { + const server = net.createServer(common.fail); + + server.listen(common.PORT, common.mustCall(() => { + const worker = cluster.fork(); + worker.on('exit', common.mustCall((exitCode) => { assert.strictEqual(exitCode, 0); server.close(); })); - }); + })); } else { - var s = net.createServer(common.fail); + const s = net.createServer(common.fail); s.listen(common.PORT, common.fail.bind(null, 'listen should have failed')); - s.on('error', common.mustCall(function(err) { + s.on('error', common.mustCall((err) => { assert.strictEqual(err.code, 'EADDRINUSE'); process.disconnect(); }));