fix(Clock): Ensure that uninstalling the clock also stops auto tick

The autotick feature mistakenly does not account for the clock being a
singleton and the re-installation of the clock causes the auto ticking
exit conditions to become true again, before it has a chance to break.
This commit is contained in:
Andrew Scott
2025-04-30 13:33:54 -07:00
parent c6b3e947e9
commit 84daa0f5dc
2 changed files with 24 additions and 0 deletions

View File

@@ -69,6 +69,10 @@ getJasmineRequireObj().Clock = function() {
* @function
*/
this.uninstall = function() {
// Ensure auto ticking loop is aborted when clock is uninstalled
if (tickMode.mode === 'auto') {
tickMode = { mode: 'manual', counter: tickMode.counter + 1 };
}
delayedFunctionScheduler = null;
mockDate.uninstall();
replace(global, realTimingFunctions);