diff --git a/test/parallel/test-child-process-disconnect.js b/test/parallel/test-child-process-disconnect.js index 4681e04053..ee9488d1cd 100644 --- a/test/parallel/test-child-process-disconnect.js +++ b/test/parallel/test-child-process-disconnect.js @@ -1,14 +1,14 @@ 'use strict'; const common = require('../common'); -var assert = require('assert'); -var fork = require('child_process').fork; -var net = require('net'); +const assert = require('assert'); +const fork = require('child_process').fork; +const net = require('net'); // child if (process.argv[2] === 'child') { // Check that the 'disconnect' event is deferred to the next event loop tick. - var disconnect = process.disconnect; + const disconnect = process.disconnect; process.disconnect = function() { disconnect.apply(this, arguments); // If the event is emitted synchronously, we're too late by now. @@ -17,7 +17,7 @@ if (process.argv[2] === 'child') { function disconnectIsNotAsync() {} }; - var server = net.createServer(); + const server = net.createServer(); server.on('connection', function(socket) { @@ -45,10 +45,10 @@ if (process.argv[2] === 'child') { } else { // testcase - var child = fork(process.argv[1], ['child']); + const child = fork(process.argv[1], ['child']); - var childFlag = false; - var parentFlag = false; + let childFlag = false; + let parentFlag = false; // when calling .disconnect the event should emit // and the disconnected flag should be true. @@ -64,7 +64,7 @@ if (process.argv[2] === 'child') { if (obj && obj.msg === 'ready') { // connect to child using TCP to know if disconnect was emitted - var socket = net.connect(obj.port); + const socket = net.connect(obj.port); socket.on('data', function(data) { data = data.toString(); @@ -84,7 +84,7 @@ if (process.argv[2] === 'child') { }); process.on('exit', function() { - assert.equal(childFlag, false); - assert.equal(parentFlag, false); + assert.strictEqual(childFlag, false); + assert.strictEqual(parentFlag, false); }); }