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‎

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
functionArrayStream(){
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
@@ -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(()=>{thrownewError();},err=>errinstanceofError);
488+
assert.throws(()=>{throw'error';},(err)=>err==='error');
489+
assert.throws(()=>{thrownewError();},(err)=>errinstanceofError);
490490

491491
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
functioninit(id){
23-
keyList=keyList.filter(e=>e!=pkeys[id]);
23+
keyList=keyList.filter((e)=>e!=pkeys[id]);
2424
}
2525

2626
functionnoop(){}

‎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
letcommandOutput='';
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
letenvOutput='';
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
constworker=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
letcontinueRecv=false;
@@ -40,9 +40,9 @@ if (cluster.isMaster){
4040
constdebugClient=net.connect({ host,port: common.PORT});
4141
constprotocol=newProtocol();
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
throwex;
8686
});
8787
}else{
88-
constserver=net.createServer(socket=>socket.pipe(socket));
88+
constserver=net.createServer((socket)=>socket.pipe(socket));
8989
constcb=()=>{
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
letstdout='';
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
letstderr='';
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
varclientLocalPorts=[];
1414
varserverRemotePorts=[];
1515
constclient=newnet.Socket();
16-
constserver=net.createServer(socket=>{
16+
constserver=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
constassert=require('assert');
44
constsym=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
constrepl=require('repl');
99

10-
constserver=net.createServer(conn=>{
10+
constserver=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
constconn=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)