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 值。