Skip to content

Commit

Permalink
fix: restore the removed condition
Browse files Browse the repository at this point in the history
eslint was complaining that `timer` does not change in the while - but it was also serving as a guard.
  • Loading branch information
dominykas committed Oct 10, 2019
1 parent ccbefa2 commit 1435b14
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions src/lolex-src.js
Original file line number Diff line number Diff line change
Expand Up @@ -856,30 +856,32 @@ function withGlobal(_global) {
function doTickInner() {
// perform each timer in the requested range
timer = firstTimerInRange(clock, tickFrom, tickTo);
while (tickFrom <= tickTo) {
if (clock.timers[timer.id]) {
tickFrom = timer.callAt;
clock.now = timer.callAt;
oldNow = clock.now;
try {
runJobs(clock);
callTimer(clock, timer);
} catch (e) {
firstException = firstException || e;
}
if (timer) {
while (tickFrom <= tickTo) {
if (clock.timers[timer.id]) {
tickFrom = timer.callAt;
clock.now = timer.callAt;
oldNow = clock.now;
try {
runJobs(clock);
callTimer(clock, timer);
} catch (e) {
firstException = firstException || e;
}

if (isAsync) {
// finish up after native setImmediate callback to allow
// all native es6 promises to process their callbacks after
// each timer fires.
originalSetTimeout(nextPromiseTick);
return;
}

if (isAsync) {
// finish up after native setImmediate callback to allow
// all native es6 promises to process their callbacks after
// each timer fires.
originalSetTimeout(nextPromiseTick);
return;
compensationCheck();
}

compensationCheck();
postTimerCall();
}

postTimerCall();
}

// perform process.nextTick()s again
Expand Down

0 comments on commit 1435b14

Please sign in to comment.