From 24590f563b90e62a160c2541d744bb467a9650bb Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 21 Nov 2018 00:57:21 +0530 Subject: [PATCH] test: replace anonymous function with arrow function --- test/parallel/test-child-process-fork-dgram.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index 4aa36261dbb24b..a25b4ad1186821 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -38,10 +38,10 @@ const assert = require('assert'); if (process.argv[2] === 'child') { let childServer; - process.once('message', function(msg, clusterServer) { + process.once('message', (msg, clusterServer) => { childServer = clusterServer; - childServer.once('message', function() { + childServer.once('message', () => { process.send('gotMessage'); childServer.close(); }); @@ -59,15 +59,15 @@ if (process.argv[2] === 'child') { let childGotMessage = false; let parentGotMessage = false; - parentServer.once('message', function(msg, rinfo) { + parentServer.once('message', (msg, rinfo) => { parentGotMessage = true; parentServer.close(); }); - parentServer.on('listening', function() { + parentServer.on('listening', () => { child.send('server', parentServer); - child.on('message', function(msg) { + child.on('message', (msg) => { if (msg === 'gotMessage') { childGotMessage = true; } else if (msg = 'handlReceived') { @@ -79,7 +79,7 @@ if (process.argv[2] === 'child') { function sendMessages() { const serverPort = parentServer.address().port; - const timer = setInterval(function() { + const timer = setInterval(() => { /* * Both the parent and the child got at least one message, * test passed, clean up everything. @@ -94,7 +94,7 @@ if (process.argv[2] === 'child') { msg.length, serverPort, '127.0.0.1', - function(err) { + (err) => { assert.ifError(err); } ); @@ -104,7 +104,7 @@ if (process.argv[2] === 'child') { parentServer.bind(0, '127.0.0.1'); - process.once('exit', function() { + process.once('exit', () => { assert(parentGotMessage); assert(childGotMessage); });