test: remove unneeded listeners

Unhandled `'error'` events will make the process exit with an unclean
exit code anyway.

PR-URL: https://github.com/nodejs/node/pull/55486
Reviewed-By: Jake Yuesong Li <jake.yuesong@gmail.com>
This commit is contained in:
Luigi Pinca 2024-10-29 22:52:09 +01:00 committed by GitHub
parent 8aac7da7d6
commit 84fe809535
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 4 additions and 11 deletions

View File

@ -32,4 +32,4 @@ const socket = dgram.createSocket(options);
socket.bind(+process.env.port, common.mustCall(() => {
socket.close();
})).on('error', common.mustNotCall());
}));

View File

@ -32,4 +32,4 @@ const server = net.createServer();
server.listen({ ...options, port: +process.env.port }, common.mustCall(() => {
server.close();
})).on('error', common.mustNotCall());
}));

View File

@ -35,5 +35,5 @@ socket1.bind(0, () => {
socket2.bind(socket1.address().port, () => {
socket1.close(close);
socket2.close(close);
}).on('error', common.mustNotCall());
}).on('error', common.mustNotCall());
});
});

View File

@ -36,6 +36,3 @@ server1.listen(options, common.mustCall(() => {
server2.close(close);
}));
}));
server1.on('error', common.mustNotCall());
server2.on('error', common.mustNotCall());

View File

@ -12,8 +12,6 @@ function test() {
socket2.close();
}));
}));
socket1.on('error', common.mustNotCall());
socket2.on('error', common.mustNotCall());
}
checkSupportReusePort().then(test, () => {

View File

@ -13,8 +13,6 @@ function test(host) {
server2.close();
}));
}));
server1.on('error', common.mustNotCall());
server2.on('error', common.mustNotCall());
}
checkSupportReusePort()