diff --git a/src/fake-timers-src.js b/src/fake-timers-src.js index 11b587d..ace42e2 100644 --- a/src/fake-timers-src.js +++ b/src/fake-timers-src.js @@ -1578,6 +1578,8 @@ function withGlobal(_global) { function doRun() { originalSetTimeout(function () { try { + runJobs(clock); + let numTimers; if (i < clock.loopLimit) { if (!clock.timers) { @@ -1633,6 +1635,7 @@ function withGlobal(_global) { try { const timer = lastTimer(clock); if (!timer) { + runJobs(clock); resolve(clock.now); } diff --git a/test/issue-async.test.js b/test/issue-async.test.js index c845986..87bfd4a 100644 --- a/test/issue-async.test.js +++ b/test/issue-async.test.js @@ -28,8 +28,10 @@ describe("bug", function () { it(`should advance past queued microtasks using ${fastForward}`, async function () { const cb = sinon.fake(); myFn(cb); + myFn(cb); + myFn(cb); await clock[fastForward](); - assert.equal(cb.callCount, 1); + assert.equal(cb.callCount, 3); }); }); });