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

Method _checkFakeTimers

packages/jest-fake-timers/src/modernFakeTimers.ts:200–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198 }
199
200 private _checkFakeTimers() {
201 if (!this._fakingTime) {
202 this._global.console.warn(
203 'A function to advance timers was called but the timers APIs are not replaced ' +
204 'with fake timers. Call `jest.useFakeTimers()` in this test file or enable ' +
205 "fake timers for all tests by setting 'fakeTimers': {'enableGlobally': true} " +
206 `in Jest configuration file.\nStack Trace:\n${formatStackTrace(
207 // eslint-disable-next-line unicorn/error-message
208 new Error().stack!,
209 this._config,
210 {noStackTrace: false},
211 )}`,
212 );
213 }
214
215 return this._fakingTime;
216 }
217
218 private _toSinonFakeTimersConfig(
219 fakeTimersConfig: Config.FakeTimersConfig = {},

Callers 14

runAllTimersMethod · 0.95
runAllTimersAsyncMethod · 0.95
runOnlyPendingTimersMethod · 0.95
advanceTimersByTimeMethod · 0.95
runAllTicksMethod · 0.95
resetMethod · 0.95
setSystemTimeMethod · 0.95

Calls 2

formatStackTraceFunction · 0.90
warnMethod · 0.45

Tested by

no test coverage detected