MCPcopy
hub / github.com/jestjs/jest / runAllImmediates

Method runAllImmediates

packages/jest-fake-timers/src/legacyFakeTimers.ts:177–195  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

175 }
176
177 runAllImmediates(): void {
178 this._checkFakeTimers();
179 // Only run a generous number of immediates and then bail.
180 let i;
181 for (i = 0; i < this._maxLoops; i++) {
182 const immediate = this._immediates.shift();
183 if (immediate === undefined) {
184 break;
185 }
186 this._runImmediate(immediate);
187 }
188
189 if (i === this._maxLoops) {
190 throw new Error(
191 `Ran ${this._maxLoops} immediates, and there are still more! Assuming ` +
192 "we've hit an infinite recursion and bailing out...",
193 );
194 }
195 }
196
197 private _runImmediate(immediate: Tick) {
198 try {

Callers 1

runAllTimersMethod · 0.95

Calls 2

_checkFakeTimersMethod · 0.95
_runImmediateMethod · 0.95

Tested by

no test coverage detected