Skip to content

Commit 2f73e6e

Browse files
TrottMylesBorins
authored andcommitted
test: use mustCall in place of countdown in timers test
Use common.mustCall() in place of countdown in test-timers-immediate-unref. PR-URL: #32416 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 6f06cf0 commit 2f73e6e

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

‎test/parallel/test-timers-immediate-unref.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

33
constcommon=require('../common');
4-
constCountdown=require('../common/countdown');
5-
64
constassert=require('assert');
75

86
constimmediate=setImmediate(()=>{});
@@ -16,12 +14,10 @@ clearImmediate(immediate);
1614
setImmediate(common.mustCall(firstStep)).ref().unref().unref().ref();
1715

1816
functionfirstStep(){
19-
constcountdown=
20-
newCountdown(2,common.mustCall(()=>setImmediate(secondStep)));
2117
// Unrefed setImmediate executes if it was unrefed but something else keeps
2218
// the loop open
23-
setImmediate(()=>countdown.dec()).unref();
24-
setTimeout(()=>countdown.dec(),50);
19+
setImmediate(common.mustCall()).unref();
20+
setTimeout(common.mustCall(()=>{setImmediate(secondStep);}),0);
2521
}
2622

2723
functionsecondStep(){

0 commit comments

Comments
 (0)