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: change anonymous closure function to arrow function #24433

Closed
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
10 changes: 5 additions & 5 deletions test/parallel/test-net-connect-options-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ const net = require('net');
const expectedConnections = 72;
let serverConnected = 0;

const server = net.createServer(common.mustCall(function(socket) {
const server = net.createServer(common.mustCall((socket) => {
socket.end('ok');
if (++serverConnected === expectedConnections) {
server.close();
}
}, expectedConnections));

server.listen(0, 'localhost', common.mustCall(function() {
const port = this.address().port;
server.listen(0, 'localhost', common.mustCall(() => {
const port = server.address().port;

// Total connections = 3 * 4(canConnect) * 6(doConnect) = 72
canConnect(port);
Expand All @@ -93,7 +93,7 @@ const net = require('net');
}));

// Try connecting to random ports, but do so once the server is closed
server.on('close', function() {
server.on('close', () => {
asyncFailToConnect(0);
asyncFailToConnect(/* undefined */);
});
Expand Down Expand Up @@ -193,7 +193,7 @@ function canConnect(port) {
}

function asyncFailToConnect(port) {
const onError = () => common.mustCall(function(err) {
const onError = () => common.mustCall((err) => {
const regexp = /^Error: connect E\w+.+$/;
assert(regexp.test(String(err)), String(err));
});
Expand Down