tracker.getCalls(fn)
新增于: v16.18.0
-
fn<Function> . -
返回:<Array> 包含对跟踪函数的所有调用。
\Returns: <Array> with all the calls to a tracked function.
-
对象 <Object>
\Object <Object>
import assert from 'node:assert'; const tracker = new assert.CallTracker(); function func() {} const callsfunc = tracker.calls(func); callsfunc(1, 2, 3); assert.deepStrictEqual(tracker.getCalls(callsfunc), [{ thisArg: this, arguments: [1, 2, 3 ] }]);const assert = require('node:assert'); // Creates call tracker. const tracker = new assert.CallTracker(); function func() {} const callsfunc = tracker.calls(func); callsfunc(1, 2, 3); assert.deepStrictEqual(tracker.getCalls(callsfunc), [{ thisArg: this, arguments: [1, 2, 3 ] }]);