diff --git a/test/parallel/test-dgram-bind-shared-ports.js b/test/parallel/test-dgram-bind-shared-ports.js index dcd96d7a7c84a5..474c352c55b5a0 100644 --- a/test/parallel/test-dgram-bind-shared-ports.js +++ b/test/parallel/test-dgram-bind-shared-ports.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var dgram = require('dgram'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const dgram = require('dgram'); -function noop() {} +function noop() { } if (cluster.isMaster) { - var worker1 = cluster.fork(); + const worker1 = cluster.fork(); if (common.isWindows) { - var checkErrType = function(er) { - assert.equal(er.code, 'ENOTSUP'); + const checkErrType = (er) => { + assert.strictEqual(er.code, 'ENOTSUP'); worker1.kill(); }; @@ -19,26 +19,26 @@ if (cluster.isMaster) { return; } - worker1.on('message', function(msg) { - assert.equal(msg, 'success'); - var worker2 = cluster.fork(); + worker1.on('message', (msg) => { + assert.strictEqual(msg, 'success'); + const worker2 = cluster.fork(); - worker2.on('message', function(msg) { - assert.equal(msg, 'socket2:EADDRINUSE'); + worker2.on('message', (msg) => { + assert.strictEqual(msg, 'socket2:EADDRINUSE'); worker1.kill(); worker2.kill(); }); }); } else { - var socket1 = dgram.createSocket('udp4', noop); - var socket2 = dgram.createSocket('udp4', noop); + const socket1 = dgram.createSocket('udp4', noop); + const socket2 = dgram.createSocket('udp4', noop); - socket1.on('error', function(err) { + socket1.on('error', (err) => { // no errors expected process.send('socket1:' + err.code); }); - socket2.on('error', function(err) { + socket2.on('error', (err) => { // an error is expected on the second worker process.send('socket2:' + err.code); }); @@ -47,8 +47,8 @@ if (cluster.isMaster) { address: 'localhost', port: common.PORT, exclusive: false - }, function() { - socket2.bind({port: common.PORT + 1, exclusive: true}, function() { + }, () => { + socket2.bind({ port: common.PORT + 1, exclusive: true }, () => { // the first worker should succeed process.send('success'); });