Skip to content

Commit efd33a2

Browse files
committed
test: update arrow function style
This commit applies new arrow function linting rules across the codebase. As it turns out, the only offenders were in the test directory. PR-URL: #4813 Reviewed-By: Rod Vagg <[email protected]> Reviewed-By: Stephen Belanger <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Saúl Ibarra Corretgé <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent 452928e commit efd33a2

14 files changed

+27
-27
lines changed

test/common.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ exports.fail = function(msg) {
470470
// A stream to push an array into a REPL
471471
function ArrayStream() {
472472
this.run = function(data) {
473-
data.forEach(line => {
473+
data.forEach((line) => {
474474
this.emit('data', line + '\n');
475475
});
476476
};

test/parallel/test-assert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ testBlockTypeError(assert.throws, undefined);
485485
testBlockTypeError(assert.doesNotThrow, undefined);
486486

487487
// https://github.com/nodejs/node/issues/3275
488-
assert.throws(() => { throw 'error'; }, err => err === 'error');
489-
assert.throws(() => { throw new Error(); }, err => err instanceof Error);
488+
assert.throws(() => { throw 'error'; }, (err) => err === 'error');
489+
assert.throws(() => { throw new Error(); }, (err) => err instanceof Error);
490490

491491
console.log('All OK');

test/parallel/test-async-wrap-check-providers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ keyList.splice(0, 1);
2020

2121

2222
function init(id) {
23-
keyList = keyList.filter(e => e != pkeys[id]);
23+
keyList = keyList.filter((e) => e != pkeys[id]);
2424
}
2525

2626
function noop() { }

test/parallel/test-child-process-spawn-shell.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let echoOutput = '';
2626

2727
assert.strictEqual(echo.spawnargs[echo.spawnargs.length - 1].replace(/"/g, ''),
2828
'echo foo');
29-
echo.stdout.on('data', data => {
29+
echo.stdout.on('data', (data) => {
3030
echoOutput += data;
3131
});
3232
echo.on('close', common.mustCall((code, signal) => {
@@ -41,7 +41,7 @@ const command = cp.spawn(cmd, {
4141
});
4242
let commandOutput = '';
4343

44-
command.stdout.on('data', data => {
44+
command.stdout.on('data', (data) => {
4545
commandOutput += data;
4646
});
4747
command.on('close', common.mustCall((code, signal) => {
@@ -56,7 +56,7 @@ const env = cp.spawn(`"${process.execPath}" -pe process.env.BAZ`, {
5656
});
5757
let envOutput = '';
5858

59-
env.stdout.on('data', data => {
59+
env.stdout.on('data', (data) => {
6060
envOutput += data;
6161
});
6262
env.on('close', common.mustCall((code, signal) => {

test/parallel/test-cluster-disconnect-handles.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ if (cluster.isMaster) {
3131
// scanner but is ignored by atoi(3). Heinous hack.
3232
cluster.setupMaster({ execArgv: [`--debug=${common.PORT}.`] });
3333
const worker = cluster.fork();
34-
worker.on('message', common.mustCall(message => {
34+
worker.on('message', common.mustCall((message) => {
3535
assert.strictEqual(Array.isArray(message), true);
3636
assert.strictEqual(message[0], 'listening');
3737
let continueRecv = false;
@@ -40,9 +40,9 @@ if (cluster.isMaster) {
4040
const debugClient = net.connect({ host, port: common.PORT });
4141
const protocol = new Protocol();
4242
debugClient.setEncoding('utf8');
43-
debugClient.on('data', data => protocol.execute(data));
43+
debugClient.on('data', (data) => protocol.execute(data));
4444
debugClient.once('connect', common.mustCall(() => {
45-
protocol.onResponse = common.mustCall(res => {
45+
protocol.onResponse = common.mustCall((res) => {
4646
protocol.onResponse = (res) => {
4747
// It can happen that the first continue was sent before the break
4848
// event was received. If that's the case, send also a continue from
@@ -85,7 +85,7 @@ if (cluster.isMaster) {
8585
throw ex;
8686
});
8787
} else {
88-
const server = net.createServer(socket => socket.pipe(socket));
88+
const server = net.createServer((socket) => socket.pipe(socket));
8989
const cb = () => {
9090
process.send(['listening', server.address()]);
9191
debugger;

test/parallel/test-debug-no-context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ proc.on('exit', common.mustCall((exitCode, signalCode) => {
1717
}));
1818
let stdout = '';
1919
proc.stdout.setEncoding('utf8');
20-
proc.stdout.on('data', data => stdout += data);
20+
proc.stdout.on('data', (data) => stdout += data);
2121
process.on('exit', () => {
2222
assert(stdout.includes('Promise { 42 }'));
2323
assert(stdout.includes('Promise { 1337 }'));

test/parallel/test-debug-port-cluster.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const child = spawn(process.execPath, args);
1515
child.stderr.setEncoding('utf8');
1616

1717
let stderr = '';
18-
child.stderr.on('data', data => {
18+
child.stderr.on('data', (data) => {
1919
stderr += data;
2020
if (child.killed !== true && stderr.includes('all workers are running'))
2121
child.kill();

test/parallel/test-net-socket-local-address.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var conns = 0;
1313
var clientLocalPorts = [];
1414
var serverRemotePorts = [];
1515
const client = new net.Socket();
16-
const server = net.createServer(socket => {
16+
const server = net.createServer((socket) => {
1717
serverRemotePorts.push(socket.remotePort);
1818
socket.end();
1919
});

test/parallel/test-process-emit.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ const common = require('../common');
33
const assert = require('assert');
44
const sym = Symbol();
55

6-
process.on('normal', common.mustCall(data => {
6+
process.on('normal', common.mustCall((data) => {
77
assert.strictEqual(data, 'normalData');
88
}));
99

10-
process.on(sym, common.mustCall(data => {
10+
process.on(sym, common.mustCall((data) => {
1111
assert.strictEqual(data, 'symbolData');
1212
}));
1313

14-
process.on('SIGPIPE', common.mustCall(data => {
14+
process.on('SIGPIPE', common.mustCall((data) => {
1515
assert.strictEqual(data, 'signalData');
1616
}));
1717

test/parallel/test-repl-require.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const net = require('net');
77
process.chdir(common.fixturesDir);
88
const repl = require('repl');
99

10-
const server = net.createServer(conn => {
10+
const server = net.createServer((conn) => {
1111
repl.start('', conn).on('exit', () => {
1212
conn.destroy();
1313
server.close();
@@ -22,7 +22,7 @@ var answer = '';
2222
server.listen(options, function() {
2323
const conn = net.connect(options);
2424
conn.setEncoding('utf8');
25-
conn.on('data', data => answer += data);
25+
conn.on('data', (data) => answer += data);
2626
conn.write('require("baz")\n.exit\n');
2727
});
2828

test/parallel/test-tls-client-mindhsize.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ testDHE1024();
7878
assert.throws(() => test(512, true, assert.fail),
7979
/DH parameter is less than 1024 bits/);
8080

81-
[0, -1, -Infinity, NaN].forEach(minDHSize => {
81+
[0, -1, -Infinity, NaN].forEach((minDHSize) => {
8282
assert.throws(() => tls.connect({ minDHSize }),
8383
/minDHSize is not a positive number/);
8484
});
8585

86-
[true, false, null, undefined, {}, [], '', '1'].forEach(minDHSize => {
86+
[true, false, null, undefined, {}, [], '', '1'].forEach((minDHSize) => {
8787
assert.throws(() => tls.connect({ minDHSize }), /minDHSize is not a number/);
8888
});
8989

test/parallel/test-tls-no-sslv3.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ server.listen(common.PORT, '127.0.0.1', function() {
4040
client.stdout.pipe(process.stdout);
4141
client.stderr.pipe(process.stderr);
4242
client.stderr.setEncoding('utf8');
43-
client.stderr.on('data', data => stderr += data);
43+
client.stderr.on('data', (data) => stderr += data);
4444

4545
client.once('exit', common.mustCall(function(exitCode) {
4646
assert.equal(exitCode, 1);
4747
server.close();
4848
}));
4949
});
5050

51-
server.on('tlsClientError', err => errors.push(err));
51+
server.on('tlsClientError', (err) => errors.push(err));
5252

5353
process.on('exit', function() {
5454
if (/unknown option -ssl3/.test(stderr)) {

test/parallel/test-util-inspect.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ for (const showHidden of [true, false]) {
106106
Uint16Array,
107107
Uint32Array,
108108
Uint8Array,
109-
Uint8ClampedArray ].forEach(constructor => {
109+
Uint8ClampedArray ].forEach((constructor) => {
110110
const length = 2;
111111
const byteLength = length * constructor.BYTES_PER_ELEMENT;
112112
const array = new constructor(new ArrayBuffer(byteLength), 0, length);
@@ -133,7 +133,7 @@ for (const showHidden of [true, false]) {
133133
Uint16Array,
134134
Uint32Array,
135135
Uint8Array,
136-
Uint8ClampedArray ].forEach(constructor => {
136+
Uint8ClampedArray ].forEach((constructor) => {
137137
const length = 2;
138138
const byteLength = length * constructor.BYTES_PER_ELEMENT;
139139
const array = vm.runInNewContext('new constructor(new ArrayBuffer(' +

test/parallel/test-v8-stats.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ const expectedHeapSpaces = [
2525
'large_object_space'
2626
];
2727
const heapSpaceStatistics = v8.getHeapSpaceStatistics();
28-
const actualHeapSpaceNames = heapSpaceStatistics.map(s => s.space_name);
28+
const actualHeapSpaceNames = heapSpaceStatistics.map((s) => s.space_name);
2929
assert.deepEqual(actualHeapSpaceNames.sort(), expectedHeapSpaces.sort());
30-
heapSpaceStatistics.forEach(heapSpace => {
30+
heapSpaceStatistics.forEach((heapSpace) => {
3131
assert.strictEqual(typeof heapSpace.space_name, 'string');
3232
assert.strictEqual(typeof heapSpace.space_size, 'number');
3333
assert.strictEqual(typeof heapSpace.space_used_size, 'number');

0 commit comments

Comments
 (0)