Skip to content

Commit b8d46f4

Browse files
cjihrigMylesBorins
authored andcommitted
test: update test-cluster-shared-handle-bind-error
- Remove assignment of this to variable. - Add common.mustCall() as needed. - Move from var to const. PR-URL: #10547 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6971630 commit b8d46f4

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

‎test/parallel/test-cluster-shared-handle-bind-error.js‎

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
'use strict';
2-
varcommon=require('../common');
3-
varassert=require('assert');
4-
varcluster=require('cluster');
5-
varnet=require('net');
2+
constcommon=require('../common');
3+
constassert=require('assert');
4+
constcluster=require('cluster');
5+
constnet=require('net');
66

77
if(cluster.isMaster){
88
// Master opens and binds the socket and shares it with the worker.
99
cluster.schedulingPolicy=cluster.SCHED_NONE;
1010
// Hog the TCP port so that when the worker tries to bind, it'll fail.
11-
net.createServer(common.fail).listen(common.PORT,function(){
12-
varserver=this;
13-
varworker=cluster.fork();
14-
worker.on('exit',common.mustCall(function(exitCode){
11+
constserver=net.createServer(common.fail);
12+
13+
server.listen(common.PORT,common.mustCall(()=>{
14+
constworker=cluster.fork();
15+
worker.on('exit',common.mustCall((exitCode)=>{
1516
assert.strictEqual(exitCode,0);
1617
server.close();
1718
}));
18-
});
19+
}));
1920
}else{
20-
vars=net.createServer(common.fail);
21+
consts=net.createServer(common.fail);
2122
s.listen(common.PORT,common.fail.bind(null,'listen should have failed'));
22-
s.on('error',common.mustCall(function(err){
23+
s.on('error',common.mustCall((err)=>{
2324
assert.strictEqual(err.code,'EADDRINUSE');
2425
process.disconnect();
2526
}));

0 commit comments

Comments
 (0)