Skip to content

Commit

Permalink
test_runner: possible fix for edge case on runAll
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Santos <[email protected]>
  • Loading branch information
khaosdoctor committed Jul 6, 2023
1 parent 1c5c8e5 commit a83b9f9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/internal/test_runner/mock/mock_timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,13 @@ class MockTimers {
}

runAll() {
// Save current state of time
const epochBeforeTick = this.#now;
// Run all timers
this.#assertTimersAreEnabled();
this.tick(Infinity);
// Return clock for the time before tick
this.#now = epochBeforeTick;
}
}

Expand Down

0 comments on commit a83b9f9

Please sign in to comment.