(cb: Callback)
| 315 | } |
| 316 | |
| 317 | runWithRealTimers(cb: Callback): void { |
| 318 | const prevClearImmediate = this._global.clearImmediate; |
| 319 | const prevClearInterval = this._global.clearInterval; |
| 320 | const prevClearTimeout = this._global.clearTimeout; |
| 321 | const prevNextTick = this._global.process.nextTick; |
| 322 | const prevSetImmediate = this._global.setImmediate; |
| 323 | const prevSetInterval = this._global.setInterval; |
| 324 | const prevSetTimeout = this._global.setTimeout; |
| 325 | |
| 326 | this.useRealTimers(); |
| 327 | |
| 328 | let cbErr = null; |
| 329 | let errThrown = false; |
| 330 | try { |
| 331 | cb(); |
| 332 | } catch (error) { |
| 333 | errThrown = true; |
| 334 | cbErr = error; |
| 335 | } |
| 336 | |
| 337 | this._global.clearImmediate = prevClearImmediate; |
| 338 | this._global.clearInterval = prevClearInterval; |
| 339 | this._global.clearTimeout = prevClearTimeout; |
| 340 | this._global.process.nextTick = prevNextTick; |
| 341 | this._global.setImmediate = prevSetImmediate; |
| 342 | this._global.setInterval = prevSetInterval; |
| 343 | this._global.setTimeout = prevSetTimeout; |
| 344 | |
| 345 | if (errThrown) { |
| 346 | throw cbErr; |
| 347 | } |
| 348 | } |
| 349 | |
| 350 | useRealTimers(): void { |
| 351 | const global = this._global; |
no test coverage detected