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.

  • function clearAllMocks(): void;
  • function fn<T extends (...args: any[]) => any>(
    func?: T
    ): Mock<T>;
  • function restoreAllMocks(): void;
  • 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(): void;
  • function useRealTimers(): void;