()
| 146 | } |
| 147 | |
| 148 | runAllTicks(): void { |
| 149 | this._checkFakeTimers(); |
| 150 | // Only run a generous number of ticks and then bail. |
| 151 | // This is just to help avoid recursive loops |
| 152 | let i; |
| 153 | for (i = 0; i < this._maxLoops; i++) { |
| 154 | const tick = this._ticks.shift(); |
| 155 | |
| 156 | if (tick === undefined) { |
| 157 | break; |
| 158 | } |
| 159 | |
| 160 | if ( |
| 161 | !Object.prototype.hasOwnProperty.call(this._cancelledTicks, tick.uuid) |
| 162 | ) { |
| 163 | // Callback may throw, so update the map prior calling. |
| 164 | this._cancelledTicks[tick.uuid] = true; |
| 165 | tick.callback(); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | if (i === this._maxLoops) { |
| 170 | throw new Error( |
| 171 | `Ran ${this._maxLoops} ticks, and there are still more! ` + |
| 172 | "Assuming we've hit an infinite recursion and bailing out...", |
| 173 | ); |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | runAllImmediates(): void { |
| 178 | this._checkFakeTimers(); |
no test coverage detected