()
| 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 { |
no test coverage detected