Bun

namespace

test.jest

namespace jest

  • type Mock<T extends (...args: any[]) => any = (...args: any[]) => any> = JestMock.Mock<T>

    Constructs the type of a mock function, e.g. the return type of jest.fn().

  • 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 clearAllMocks(): void;
  • function clearAllTimers(): void;
  • function fn<T extends (...args: any[]) => any>(
    func?: T
    ): Mock<T>;
  • function getTimerCount(): number;
  • function isFakeTimers(): boolean;
  • function resetAllMocks(): void;
  • function restoreAllMocks(): void;
  • 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 };
  • function setSystemTime(
    now?: number | Date
    ): void;
  • function setTimeout(
    milliseconds: number
    ): void;
  • function spyOn<T extends object, K extends string | number | symbol>(
    obj: T,
    methodOrPropertyValue: K
    ): Mock<Extract<T[K], (...args: any[]) => any>>;
  • function useFakeTimers(
    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 };