Constructs the type of a mock function, e.g. the return type of jest.fn().
namespace
test.jest
namespace jest
- type Mock<T extends (...args: any[]) => any = (...args: any[]) => any> = JestMock.Mock<T>
- type Replaced<T> = JestMock.Replaced<T>
Constructs the type of a replaced property.
- type Spied<T extends JestMock.ClassLike | (...args: any[]) => any> = JestMock.Spied<T>
Constructs the type of a spied class or function.
- type SpiedClass<T extends JestMock.ClassLike> = JestMock.SpiedClass<T>
Constructs the type of a spied class.
- type SpiedFunction<T extends (...args: any[]) => any> = JestMock.SpiedFunction<T>
Constructs the type of a spied function.
- type SpiedGetter<T> = JestMock.SpiedGetter<T>
Constructs the type of a spied getter.
- type SpiedSetter<T> = JestMock.SpiedSetter<T>
Constructs the type of a spied setter.
- milliseconds: number): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };
- function advanceTimersToNextTimer(): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };
- function runAllTimers(): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };
- function runOnlyPendingTimers(): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };
- options?: { now: number | Date }): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };
- function useRealTimers(): { advanceTimersByTime: (milliseconds: number) => unknown; advanceTimersToNextTimer: () => unknown; clearAllMocks: () => void; clearAllTimers: () => void; fn: (func?: T) => Mock<T>; getTimerCount: () => number; isFakeTimers: () => boolean; mock: (id: string, factory: () => any) => void | Promise<void>; resetAllMocks: () => void; restoreAllMocks: () => void; runAllTimers: () => unknown; runOnlyPendingTimers: () => unknown; spyOn: (obj: T, methodOrPropertyValue: K) => Mock<Extract<T[K], (...args: any[]) => any>>; useFakeTimers: (options?: { now: number | Date }) => unknown; useRealTimers: () => unknown };