ctx.accesses


一个 getter,返回用于跟踪对模拟属性的访问(get/set)的内部数组的副本。数组中的每个条目都是一个具有以下属性的对象:

¥A getter that returns a copy of the internal array used to track accesses (get/set) to the mocked property. Each entry in the array is an object with the following properties:

  • type <string> 'get''set',指示访问类型。

    ¥type <string> Either 'get' or 'set', indicating the type of access.

  • value <any> 读取的值(对于 'get')或写入的值(对于 'set')。

    ¥value <any> The value that was read (for 'get') or written (for 'set').

  • stack <Error> 一个 Error 对象,其堆栈可用于确定模拟函数调用的调用点。

    ¥stack <Error> An Error object whose stack can be used to determine the callsite of the mocked function invocation.