Skip to content

Commit

Permalink
test: replace anonymous closure functions with arrow function
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Abhishek Dixit authored and codebytere committed Jan 29, 2019
1 parent 66c3dca commit 283a6b8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-tls-ticket-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ if (cluster.isMaster) {
const c = tls.connect(workerPort, {
session: lastSession,
rejectUnauthorized: false
}, function() {
}, () => {
lastSession = c.getSession();
c.end();

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

function fork() {
const worker = cluster.fork();
worker.on('message', function({ msg, port }) {
worker.on('message', ({ msg, port }) => {
console.error('[master] got %j', msg);
if (msg === 'reused') {
++reusedCount;
Expand All @@ -71,15 +71,15 @@ if (cluster.isMaster) {
}
});

worker.on('exit', function() {
worker.on('exit', () => {
console.error('[master] worker died');
});
}
for (let i = 0; i < workerCount; i++) {
fork();
}

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

const options = { key, cert };

const server = tls.createServer(options, function(c) {
const server = tls.createServer(options, (c) => {
if (c.isSessionReused()) {
process.send({ msg: 'reused' });
} else {
Expand All @@ -100,7 +100,7 @@ const server = tls.createServer(options, function(c) {
c.end();
});

server.listen(0, function() {
server.listen(0, () => {
const { port } = server.address();
process.send({
msg: 'listening',
Expand All @@ -111,14 +111,14 @@ server.listen(0, function() {
process.on('message', function listener(msg) {
console.error('[worker] got %j', msg);
if (msg === 'die') {
server.close(function() {
server.close(() => {
console.error('[worker] server close');

process.exit();
});
}
});

process.on('exit', function() {
process.on('exit', () => {
console.error('[worker] exit');
});

0 comments on commit 283a6b8

Please sign in to comment.