Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replace anonymous function with arrow function #24529

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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