Skip to content

Commit

Permalink
test: replace anonymous function with arrow function
Browse files Browse the repository at this point in the history
PR-URL: #24529
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
  • Loading branch information
codegagan authored and targos committed Nov 24, 2018
1 parent 87dc362 commit 300887d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-child-process-fork-dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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') {
Expand All @@ -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.
Expand All @@ -94,7 +94,7 @@ if (process.argv[2] === 'child') {
msg.length,
serverPort,
'127.0.0.1',
function(err) {
(err) => {
assert.ifError(err);
}
);
Expand All @@ -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);
});
Expand Down

0 comments on commit 300887d

Please sign in to comment.