diff --git a/test/parallel/test-timers-clearImmediate.js b/test/parallel/test-timers-clearImmediate.js index c49fd7622f..ccd9826bb0 100644 --- a/test/parallel/test-timers-clearImmediate.js +++ b/test/parallel/test-timers-clearImmediate.js @@ -1,18 +1,13 @@ 'use strict'; -require('../common'); -const assert = require('assert'); +const common = require('../common'); const N = 3; -let count = 0; + function next() { - const immediate = setImmediate(function() { - clearImmediate(immediate); - ++count; - }); + const fn = common.mustCall(() => clearImmediate(immediate)); + const immediate = setImmediate(fn); } -for (let i = 0; i < N; ++i) - next(); -process.on('exit', () => { - assert.strictEqual(count, N, `Expected ${N} immediate callback executions`); -}); +for (let i = 0; i < N; i++) { + next(); +}