Skip to content

Commit

Permalink
test: use mustCall in place of countdown in timers test
Browse files Browse the repository at this point in the history
Use common.mustCall() in place of countdown in
test-timers-immediate-unref.

PR-URL: #32416
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Mar 24, 2020
1 parent 6f06cf0 commit 2f73e6e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions test/parallel/test-timers-immediate-unref.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

const common = require('../common');
const Countdown = require('../common/countdown');

const assert = require('assert');

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

function firstStep() {
const countdown =
new Countdown(2, common.mustCall(() => setImmediate(secondStep)));
// Unrefed setImmediate executes if it was unrefed but something else keeps
// the loop open
setImmediate(() => countdown.dec()).unref();
setTimeout(() => countdown.dec(), 50);
setImmediate(common.mustCall()).unref();
setTimeout(common.mustCall(() => { setImmediate(secondStep); }), 0);
}

function secondStep() {
Expand Down

0 comments on commit 2f73e6e

Please sign in to comment.