Skip to content

Commit a83b9f9

Browse files
committed
test_runner: possible fix for edge case on runAll
Signed-off-by: Lucas Santos <[email protected]>
1 parent 1c5c8e5 commit a83b9f9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/internal/test_runner/mock/mock_timers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,13 @@ class MockTimers {
490490
}
491491

492492
runAll() {
493+
// Save current state of time
494+
const epochBeforeTick = this.#now;
495+
// Run all timers
493496
this.#assertTimersAreEnabled();
494497
this.tick(Infinity);
498+
// Return clock for the time before tick
499+
this.#now = epochBeforeTick;
495500
}
496501
}
497502

0 commit comments

Comments
 (0)