Skip to content

Commit 283a6b8

Browse files
Abhishek Dixitcodebytere
authored andcommitted
test: replace anonymous closure functions with arrow function
PR-URL: #24420 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 66c3dca commit 283a6b8

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎test/parallel/test-tls-ticket-cluster.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if (cluster.isMaster) {
4444
constc=tls.connect(workerPort,{
4545
session: lastSession,
4646
rejectUnauthorized: false
47-
},function(){
47+
},()=>{
4848
lastSession=c.getSession();
4949
c.end();
5050

@@ -60,7 +60,7 @@ if (cluster.isMaster) {
6060

6161
functionfork(){
6262
constworker=cluster.fork();
63-
worker.on('message',function({ msg, port }){
63+
worker.on('message',({ msg, port })=>{
6464
console.error('[master] got %j',msg);
6565
if(msg==='reused'){
6666
++reusedCount;
@@ -71,15 +71,15 @@ if (cluster.isMaster) {
7171
}
7272
});
7373

74-
worker.on('exit',function(){
74+
worker.on('exit',()=>{
7575
console.error('[master] worker died');
7676
});
7777
}
7878
for(leti=0;i<workerCount;i++){
7979
fork();
8080
}
8181

82-
process.on('exit',function(){
82+
process.on('exit',()=>{
8383
assert.strictEqual(reqCount,expectedReqCount);
8484
assert.strictEqual(reusedCount+1,reqCount);
8585
});
@@ -91,7 +91,7 @@ const cert = fixtures.readSync('agent.crt');
9191

9292
constoptions={ key, cert };
9393

94-
constserver=tls.createServer(options,function(c){
94+
constserver=tls.createServer(options,(c)=>{
9595
if(c.isSessionReused()){
9696
process.send({msg: 'reused'});
9797
}else{
@@ -100,7 +100,7 @@ const server = tls.createServer(options, function(c) {
100100
c.end();
101101
});
102102

103-
server.listen(0,function(){
103+
server.listen(0,()=>{
104104
const{ port }=server.address();
105105
process.send({
106106
msg: 'listening',
@@ -111,14 +111,14 @@ server.listen(0, function() {
111111
process.on('message',functionlistener(msg){
112112
console.error('[worker] got %j',msg);
113113
if(msg==='die'){
114-
server.close(function(){
114+
server.close(()=>{
115115
console.error('[worker] server close');
116116

117117
process.exit();
118118
});
119119
}
120120
});
121121

122-
process.on('exit',function(){
122+
process.on('exit',()=>{
123123
console.error('[worker] exit');
124124
});

0 commit comments

Comments
 (0)