diff --git a/test/parallel/test-timers-clearImmediate.js b/test/parallel/test-timers-clearImmediate.js index c49fd7622f4ab6..44a8f59d428c7a 100644 --- a/test/parallel/test-timers-clearImmediate.js +++ b/test/parallel/test-timers-clearImmediate.js @@ -1,18 +1,14 @@ '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 immediate = setImmediate( + common.mustCall(() => clearImmediate(immediate)) + ); } -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(); +}