Skip to content

Commit 7f5b89c

Browse files
Trotttargos
authored andcommittedApr 22, 2020
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 46e68bb commit 7f5b89c

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed
 

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

33
const common = require('../common');
4-
const Countdown = require('../common/countdown');
5-
64
const assert = require('assert');
75

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

1816
function firstStep() {
19-
const countdown =
20-
new Countdown(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
function secondStep() {

0 commit comments

Comments
 (0)
Please sign in to comment.