Interface MockContext<T, Y, C>

interface MockContext<T, Y extends any[], C = any> {
    calls: Y[];
    contexts: C[];
    instances: T[];
    invocationCallOrder: number[];
    lastCall?: Y;
    results: MockResult<T>[];
}

Type Parameters

  • T
  • Y extends any[]
  • C = any

Properties

calls: Y[]

List of the call arguments of all calls that have been made to the mock.

contexts: C[]

List of the call contexts of all calls that have been made to the mock.

instances: T[]

List of all the object instances that have been instantiated from the mock.

invocationCallOrder: number[]

List of the call order indexes of the mock. Jest is indexing the order of invocations of all mocks in a test file. The index is starting with 1.

lastCall?: Y

List of the call arguments of the last call that was made to the mock. If the function was not called, it will return undefined.

results: MockResult<T>[]

List of the results of all calls that have been made to the mock.