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

Method useRealTimers

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

Source from the content-addressed store, hash-verified

348 }
349
350 useRealTimers(): void {
351 const global = this._global;
352
353 if (typeof global.cancelAnimationFrame === 'function') {
354 setGlobal(
355 global,
356 'cancelAnimationFrame',
357 this._timerAPIs.cancelAnimationFrame,
358 );
359 }
360 if (typeof global.clearImmediate === 'function') {
361 setGlobal(global, 'clearImmediate', this._timerAPIs.clearImmediate);
362 }
363 setGlobal(global, 'clearInterval', this._timerAPIs.clearInterval);
364 setGlobal(global, 'clearTimeout', this._timerAPIs.clearTimeout);
365 if (typeof global.requestAnimationFrame === 'function') {
366 setGlobal(
367 global,
368 'requestAnimationFrame',
369 this._timerAPIs.requestAnimationFrame,
370 );
371 }
372 if (typeof global.setImmediate === 'function') {
373 setGlobal(global, 'setImmediate', this._timerAPIs.setImmediate);
374 }
375 setGlobal(global, 'setInterval', this._timerAPIs.setInterval);
376 setGlobal(global, 'setTimeout', this._timerAPIs.setTimeout);
377
378 global.process.nextTick = this._timerAPIs.nextTick;
379
380 this._fakingTime = false;
381 }
382
383 useFakeTimers(): void {
384 this._createMocks();

Callers 1

runWithRealTimersMethod · 0.95

Calls 1

setGlobalFunction · 0.90

Tested by

no test coverage detected