Skip to content

Commit 2c8c7b8

Browse files
codegaganrvagg
authored andcommitted
test: replace anonymous function with arrow function
PR-URL: #24529 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 7b0292a commit 2c8c7b8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/parallel/test-child-process-fork-dgram.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ const assert = require('assert');
3838
if (process.argv[2] === 'child') {
3939
let childServer;
4040

41-
process.once('message', function(msg, clusterServer) {
41+
process.once('message', (msg, clusterServer) => {
4242
childServer = clusterServer;
4343

44-
childServer.once('message', function() {
44+
childServer.once('message', () => {
4545
process.send('gotMessage');
4646
childServer.close();
4747
});
@@ -59,15 +59,15 @@ if (process.argv[2] === 'child') {
5959
let childGotMessage = false;
6060
let parentGotMessage = false;
6161

62-
parentServer.once('message', function(msg, rinfo) {
62+
parentServer.once('message', (msg, rinfo) => {
6363
parentGotMessage = true;
6464
parentServer.close();
6565
});
6666

67-
parentServer.on('listening', function() {
67+
parentServer.on('listening', () => {
6868
child.send('server', parentServer);
6969

70-
child.on('message', function(msg) {
70+
child.on('message', (msg) => {
7171
if (msg === 'gotMessage') {
7272
childGotMessage = true;
7373
} else if (msg = 'handlReceived') {
@@ -79,7 +79,7 @@ if (process.argv[2] === 'child') {
7979
function sendMessages() {
8080
const serverPort = parentServer.address().port;
8181

82-
const timer = setInterval(function() {
82+
const timer = setInterval(() => {
8383
/*
8484
* Both the parent and the child got at least one message,
8585
* test passed, clean up everything.
@@ -94,7 +94,7 @@ if (process.argv[2] === 'child') {
9494
msg.length,
9595
serverPort,
9696
'127.0.0.1',
97-
function(err) {
97+
(err) => {
9898
assert.ifError(err);
9999
}
100100
);
@@ -104,7 +104,7 @@ if (process.argv[2] === 'child') {
104104

105105
parentServer.bind(0, '127.0.0.1');
106106

107-
process.once('exit', function() {
107+
process.once('exit', () => {
108108
assert(parentGotMessage);
109109
assert(childGotMessage);
110110
});

0 commit comments

Comments
 (0)