ctx.calls


一个 getter,用于返回用于跟踪对模拟调用的内部数组的副本。数组中的每个条目都是一个具有以下属性的对象。

【A getter that returns a copy of the internal array used to track calls to the mock. Each entry in the array is an object with the following properties.】

  • arguments <Array> 传递给模拟函数的参数数组。
  • error <any> 如果模拟函数抛出异常,则此属性包含被抛出的值。默认值:undefined
  • result <any> 模拟函数返回的值。
  • stack <Error> 一个 Error 对象,其堆栈可用于确定模拟函数调用的位置。
  • target <Function> | <undefined> 如果被模拟的函数是一个构造函数,该字段包含正在构建的类。否则,它将是 undefined
  • this <any> 模拟函数的 this 值。