Skip to content

Commit 607f545

Browse files
targosMyles Borins
authored and
Myles Borins
committed
test: fix style issues after eslint update
Replace var keyword with const or let. PR-URL: #2286 Reviewed-By: Roman Reiss <[email protected]>
1 parent 066d5e7 commit 607f545

File tree

109 files changed

+943
-896
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+943
-896
lines changed

test/common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ exports.getServiceName = function getServiceName(port, protocol) {
437437
if (matches && matches.length > 1) {
438438
serviceName = matches[1];
439439
}
440-
} catch(e) {
440+
} catch (e) {
441441
console.error('Cannot read file: ', etcServicesFileName);
442442
return undefined;
443443
}

test/debugger/test-debugger-repl-break-in-module.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [
2020

2121
// continue - the breakpoint should be triggered
2222
repl.addTest('c', [
23-
/break in .*[\\\/]mod\.js:23/,
24-
/21/, /22/, /23/, /24/, /25/
23+
/break in .*[\\\/]mod\.js:23/,
24+
/21/, /22/, /23/, /24/, /25/
2525
]);
2626

2727
// -- RESTORE BREAKPOINT ON RESTART --

test/debugger/test-debugger-repl-restart.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var repl = require('./helper-debugger-repl.js');
44

55
repl.startDebugger('breakpoints.js');
66
var linesWithBreakpoint = [
7-
/1/, /2/, /3/, /4/, /5/, /\* 6/
7+
/1/, /2/, /3/, /4/, /5/, /\* 6/
88
];
99
// We slice here, because addTest will change the given array.
1010
repl.addTest('sb(6)', linesWithBreakpoint.slice());

test/gc/test-http-client-connaborted.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ function serverHandler(req, res) {
66
res.connection.destroy();
77
}
88

9-
var http = require('http'),
10-
weak = require('weak'),
11-
done = 0,
12-
count = 0,
13-
countGC = 0,
14-
todo = 500,
15-
common = require('../common'),
16-
assert = require('assert'),
17-
PORT = common.PORT;
9+
const http = require('http');
10+
const weak = require('weak');
11+
const common = require('../common');
12+
const assert = require('assert');
13+
const PORT = common.PORT;
14+
const todo = 500;
15+
let done = 0;
16+
let count = 0;
17+
let countGC = 0;
1818

1919
console.log('We should do ' + todo + ' requests');
2020

test/gc/test-http-client-onerror.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ function serverHandler(req, res) {
88
res.end('Hello World\n');
99
}
1010

11-
var http = require('http'),
12-
weak = require('weak'),
13-
done = 0,
14-
count = 0,
15-
countGC = 0,
16-
todo = 500,
17-
common = require('../common'),
18-
assert = require('assert'),
19-
PORT = common.PORT;
11+
const http = require('http');
12+
const weak = require('weak');
13+
const common = require('../common');
14+
const assert = require('assert');
15+
const PORT = common.PORT;
16+
const todo = 500;
17+
let done = 0;
18+
let count = 0;
19+
let countGC = 0;
2020

2121
console.log('We should do ' + todo + ' requests');
2222

test/gc/test-http-client-timeout.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ function serverHandler(req, res) {
1010
}, 100);
1111
}
1212

13-
var http = require('http'),
14-
weak = require('weak'),
15-
done = 0,
16-
count = 0,
17-
countGC = 0,
18-
todo = 550,
19-
common = require('../common'),
20-
assert = require('assert'),
21-
PORT = common.PORT;
13+
const http = require('http');
14+
const weak = require('weak');
15+
const common = require('../common');
16+
const assert = require('assert');
17+
const PORT = common.PORT;
18+
const todo = 550;
19+
let done = 0;
20+
let count = 0;
21+
let countGC = 0;
2222

2323
console.log('We should do ' + todo + ' requests');
2424

test/gc/test-http-client.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ function serverHandler(req, res) {
66
res.end('Hello World\n');
77
}
88

9-
var http = require('http'),
10-
weak = require('weak'),
11-
done = 0,
12-
count = 0,
13-
countGC = 0,
14-
todo = 500,
15-
common = require('../common'),
16-
assert = require('assert'),
17-
PORT = common.PORT;
9+
const http = require('http');
10+
const weak = require('weak');
11+
const common = require('../common');
12+
const assert = require('assert');
13+
const PORT = common.PORT;
14+
const todo = 500;
15+
let done = 0;
16+
let count = 0;
17+
let countGC = 0;
1818

1919
console.log('We should do ' + todo + ' requests');
2020

test/gc/test-net-timeout.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ function serverHandler(sock) {
1717
}, 100);
1818
}
1919

20-
var net = require('net'),
21-
weak = require('weak'),
22-
done = 0,
23-
count = 0,
24-
countGC = 0,
25-
todo = 500,
26-
common = require('../common'),
27-
assert = require('assert'),
28-
PORT = common.PORT;
20+
const net = require('net');
21+
const weak = require('weak');
22+
const common = require('../common');
23+
const assert = require('assert');
24+
const PORT = common.PORT;
25+
const todo = 500;
26+
let done = 0;
27+
let count = 0;
28+
let countGC = 0;
2929

3030
console.log('We should do ' + todo + ' requests');
3131

test/internet/test-dgram-broadcast-multi-process.js

+37-31
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
'use strict';
2-
var common = require('../common'),
3-
assert = require('assert'),
4-
dgram = require('dgram'),
5-
util = require('util'),
6-
networkInterfaces = require('os').networkInterfaces(),
7-
Buffer = require('buffer').Buffer,
8-
fork = require('child_process').fork,
9-
LOCAL_BROADCAST_HOST = '255.255.255.255',
10-
TIMEOUT = common.platformTimeout(5000),
11-
messages = [
12-
new Buffer('First message to send'),
13-
new Buffer('Second message to send'),
14-
new Buffer('Third message to send'),
15-
new Buffer('Fourth message to send')
16-
];
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const dgram = require('dgram');
5+
const util = require('util');
6+
const networkInterfaces = require('os').networkInterfaces();
7+
const Buffer = require('buffer').Buffer;
8+
const fork = require('child_process').fork;
9+
const LOCAL_BROADCAST_HOST = '255.255.255.255';
10+
const TIMEOUT = common.platformTimeout(5000);
11+
const messages = [
12+
new Buffer('First message to send'),
13+
new Buffer('Second message to send'),
14+
new Buffer('Third message to send'),
15+
new Buffer('Fourth message to send')
16+
];
1717

1818
if (common.inFreeBSDJail) {
1919
console.log('1..0 # Skipped: in a FreeBSD jail');
@@ -34,13 +34,13 @@ get_bindAddress: for (var name in networkInterfaces) {
3434
assert.ok(bindAddress);
3535

3636
if (process.argv[2] !== 'child') {
37-
var workers = {},
38-
listeners = 3,
39-
listening = 0,
40-
dead = 0,
41-
i = 0,
42-
done = 0,
43-
timer = null;
37+
const workers = {};
38+
const listeners = 3;
39+
let listening = 0;
40+
let dead = 0;
41+
let i = 0;
42+
let done = 0;
43+
let timer = null;
4444

4545
//exit the test if it doesn't succeed within TIMEOUT
4646
timer = setTimeout(function() {
@@ -166,15 +166,21 @@ if (process.argv[2] !== 'child') {
166166
return;
167167
}
168168

169-
sendSocket.send(buf, 0, buf.length,
170-
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
171-
if (err) throw err;
172-
console.error('[PARENT] sent %s to %s:%s',
173-
util.inspect(buf.toString()),
174-
LOCAL_BROADCAST_HOST, common.PORT);
175-
176-
process.nextTick(sendSocket.sendNext);
177-
});
169+
sendSocket.send(
170+
buf,
171+
0,
172+
buf.length,
173+
common.PORT,
174+
LOCAL_BROADCAST_HOST,
175+
function(err) {
176+
if (err) throw err;
177+
console.error('[PARENT] sent %s to %s:%s',
178+
util.inspect(buf.toString()),
179+
LOCAL_BROADCAST_HOST, common.PORT);
180+
181+
process.nextTick(sendSocket.sendNext);
182+
}
183+
);
178184
};
179185

180186
function killChildren(children) {

test/internet/test-dgram-multicast-multi-process.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,20 @@ if (process.argv[2] !== 'child') {
157157
return;
158158
}
159159

160-
sendSocket.send(buf, 0, buf.length,
161-
common.PORT, LOCAL_BROADCAST_HOST, function(err) {
162-
if (err) throw err;
163-
console.error('[PARENT] sent "%s" to %s:%s',
164-
buf.toString(),
165-
LOCAL_BROADCAST_HOST, common.PORT);
166-
process.nextTick(sendSocket.sendNext);
167-
});
160+
sendSocket.send(
161+
buf,
162+
0,
163+
buf.length,
164+
common.PORT,
165+
LOCAL_BROADCAST_HOST,
166+
function(err) {
167+
if (err) throw err;
168+
console.error('[PARENT] sent "%s" to %s:%s',
169+
buf.toString(),
170+
LOCAL_BROADCAST_HOST, common.PORT);
171+
process.nextTick(sendSocket.sendNext);
172+
}
173+
);
168174
};
169175
}
170176

test/internet/test-dns-ipv4.js

+25-22
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert'),
4-
dns = require('dns'),
5-
net = require('net'),
6-
isIPv4 = net.isIPv4;
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const dns = require('dns');
5+
const net = require('net');
6+
const isIPv4 = net.isIPv4;
77

8-
var expected = 0,
9-
completed = 0,
10-
running = false,
11-
queue = [];
8+
let expected = 0;
9+
let completed = 0;
10+
let running = false;
11+
const queue = [];
1212

1313
function TEST(f) {
1414
function next() {
@@ -148,19 +148,22 @@ TEST(function test_lookup_localhost_ipv4(done) {
148148
});
149149

150150
TEST(function test_lookup_all_ipv4(done) {
151-
var req = dns.lookup('www.google.com', {all: true, family: 4},
152-
function(err, ips) {
153-
if (err) throw err;
154-
assert.ok(Array.isArray(ips));
155-
assert.ok(ips.length > 0);
156-
157-
ips.forEach(function(ip) {
158-
assert.ok(isIPv4(ip.address));
159-
assert.strictEqual(ip.family, 4);
160-
});
161-
162-
done();
163-
});
151+
var req = dns.lookup(
152+
'www.google.com',
153+
{all: true, family: 4},
154+
function(err, ips) {
155+
if (err) throw err;
156+
assert.ok(Array.isArray(ips));
157+
assert.ok(ips.length > 0);
158+
159+
ips.forEach(function(ip) {
160+
assert.ok(isIPv4(ip.address));
161+
assert.strictEqual(ip.family, 4);
162+
});
163+
164+
done();
165+
}
166+
);
164167

165168
checkWrap(req);
166169
});

test/internet/test-dns-ipv6.js

+26-23
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
'use strict';
2-
var common = require('../common');
3-
var assert = require('assert'),
4-
dns = require('dns'),
5-
net = require('net'),
6-
isIPv6 = net.isIPv6;
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const dns = require('dns');
5+
const net = require('net');
6+
const isIPv6 = net.isIPv6;
77

8-
var expected = 0,
9-
completed = 0,
10-
running = false,
11-
queue = [];
8+
let expected = 0;
9+
let completed = 0;
10+
let running = false;
11+
const queue = [];
1212

1313
if (!common.hasIPv6) {
1414
console.log('1..0 # Skipped: this test, no IPv6 support');
@@ -156,20 +156,23 @@ TEST(function test_lookup_ip_ipv6(done) {
156156
});
157157

158158
TEST(function test_lookup_all_ipv6(done) {
159-
var req = dns.lookup('www.google.com', {all: true, family: 6},
160-
function(err, ips) {
161-
if (err) throw err;
162-
assert.ok(Array.isArray(ips));
163-
assert.ok(ips.length > 0);
164-
165-
ips.forEach(function(ip) {
166-
assert.ok(isIPv6(ip.address),
167-
'Invalid IPv6: ' + ip.address.toString());
168-
assert.strictEqual(ip.family, 6);
169-
});
170-
171-
done();
172-
});
159+
var req = dns.lookup(
160+
'www.google.com',
161+
{all: true, family: 6},
162+
function(err, ips) {
163+
if (err) throw err;
164+
assert.ok(Array.isArray(ips));
165+
assert.ok(ips.length > 0);
166+
167+
ips.forEach(function(ip) {
168+
assert.ok(isIPv6(ip.address),
169+
'Invalid IPv6: ' + ip.address.toString());
170+
assert.strictEqual(ip.family, 6);
171+
});
172+
173+
done();
174+
}
175+
);
173176

174177
checkWrap(req);
175178
});

0 commit comments

Comments
 (0)