Skip to content

Commit 14025db

Browse files
wzoomFishrock123
authored andcommitted
test: cleanup test-child-process-disconnect.js
Changed var --> const and let Changed assert.equal --> assert.strictEqual PR-URL: #8602 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
1 parent 9032ba6 commit 14025db

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/parallel/test-child-process-disconnect.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
22
const common = require('../common');
3-
var assert = require('assert');
4-
var fork = require('child_process').fork;
5-
var net = require('net');
3+
const assert = require('assert');
4+
const fork = require('child_process').fork;
5+
const net = require('net');
66

77
// child
88
if (process.argv[2] === 'child') {
99

1010
// Check that the 'disconnect' event is deferred to the next event loop tick.
11-
var disconnect = process.disconnect;
11+
const disconnect = process.disconnect;
1212
process.disconnect = function() {
1313
disconnect.apply(this, arguments);
1414
// If the event is emitted synchronously, we're too late by now.
@@ -17,7 +17,7 @@ if (process.argv[2] === 'child') {
1717
function disconnectIsNotAsync() {}
1818
};
1919

20-
var server = net.createServer();
20+
const server = net.createServer();
2121

2222
server.on('connection', function(socket) {
2323

@@ -45,10 +45,10 @@ if (process.argv[2] === 'child') {
4545

4646
} else {
4747
// testcase
48-
var child = fork(process.argv[1], ['child']);
48+
const child = fork(process.argv[1], ['child']);
4949

50-
var childFlag = false;
51-
var parentFlag = false;
50+
let childFlag = false;
51+
let parentFlag = false;
5252

5353
// when calling .disconnect the event should emit
5454
// and the disconnected flag should be true.
@@ -64,7 +64,7 @@ if (process.argv[2] === 'child') {
6464
if (obj && obj.msg === 'ready') {
6565

6666
// connect to child using TCP to know if disconnect was emitted
67-
var socket = net.connect(obj.port);
67+
const socket = net.connect(obj.port);
6868

6969
socket.on('data', function(data) {
7070
data = data.toString();
@@ -84,7 +84,7 @@ if (process.argv[2] === 'child') {
8484
});
8585

8686
process.on('exit', function() {
87-
assert.equal(childFlag, false);
88-
assert.equal(parentFlag, false);
87+
assert.strictEqual(childFlag, false);
88+
assert.strictEqual(parentFlag, false);
8989
});
9090
}

0 commit comments

Comments
 (0)