Skip to content

Commit f2bd867

Browse files
cjihrigrvagg
authored andcommitted
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 <rod@vagg.org> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
1 parent a3a0cf6 commit f2bd867

13 files changed

+25
-25
lines changed

test/common.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ testBlockTypeError(assert.throws, undefined);
484484
testBlockTypeError(assert.doesNotThrow, undefined);
485485

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

490490
console.log('All OK');

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 2 additions & 2 deletions
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

0 commit comments

Comments
 (0)