Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 122917d

Browse filesBrowse files
Daniel SimsMylesBorins
authored andcommitted
test: change var declarations, add mustCall check
In this test, I changed the var declarations to be either a let or a const. For some of the callbacks, I added a mustCall check to ensure that the functions have run. I also changed assert.equal() to assert.strictEqual(). PR-URL: #9962 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent d5e911c commit 122917d
Copy full SHA for 122917d

File tree

Expand file treeCollapse file tree

1 file changed

+17
-16
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+17
-16
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-cluster-net-send.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-cluster-net-send.js
+17-16Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,51 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert');
4-
var fork = require('child_process').fork;
5-
var net = require('net');
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const fork = require('child_process').fork;
5+
const net = require('net');
66

77
if (process.argv[2] !== 'child') {
88
console.error('[%d] master', process.pid);
99

10-
var worker = fork(__filename, ['child']);
11-
var called = false;
10+
const worker = fork(__filename, ['child']);
11+
let called = false;
1212

13-
worker.once('message', function(msg, handle) {
14-
assert.equal(msg, 'handle');
13+
worker.once('message', common.mustCall(function(msg, handle) {
14+
assert.strictEqual(msg, 'handle');
1515
assert.ok(handle);
1616
worker.send('got');
1717

1818
handle.on('data', function(data) {
1919
called = true;
20-
assert.equal(data.toString(), 'hello');
20+
assert.strictEqual(data.toString(), 'hello');
2121
});
2222

2323
handle.on('end', function() {
2424
worker.kill();
2525
});
26-
});
26+
}));
2727

2828
process.once('exit', function() {
2929
assert.ok(called);
3030
});
3131
} else {
3232
console.error('[%d] worker', process.pid);
3333

34-
var socket;
35-
var cbcalls = 0;
34+
let socket;
35+
let cbcalls = 0;
3636
function socketConnected() {
3737
if (++cbcalls === 2)
3838
process.send('handle', socket);
3939
}
4040

41-
var server = net.createServer(function(c) {
42-
process.once('message', function(msg) {
43-
assert.equal(msg, 'got');
41+
const server = net.createServer(function(c) {
42+
process.once('message', common.mustCall(function(msg) {
43+
assert.strictEqual(msg, 'got');
4444
c.end('hello');
45-
});
45+
}));
4646
socketConnected();
4747
});
48+
4849
server.listen(common.PORT, function() {
4950
socket = net.connect(common.PORT, '127.0.0.1', socketConnected);
5051
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.