tracker.reset([fn])
fn<Function> 一个可追踪的函数以重置。
重置调用跟踪器的调用次数。 如果跟踪的函数作为参数传递,它的调用次数将被重置。 如果没有传递参数,所有被跟踪的函数将被重置。
【reset calls of the call tracker. if a tracked function is passed as an argument, the calls will be reset for it. if no arguments are passed, all tracked functions will be reset】
import assert from 'node:assert';
const tracker = new assert.CallTracker();
function func() {}
const callsfunc = tracker.calls(func);
callsfunc();
// Tracker was called once
tracker.getCalls(callsfunc).length === 1;
tracker.reset(callsfunc);
tracker.getCalls(callsfunc).length === 0;const assert = require('node:assert');
function func() {}
const callsfunc = tracker.calls(func);
callsfunc();
// Tracker was called once
tracker.getCalls(callsfunc).length === 1;
tracker.reset(callsfunc);
tracker.getCalls(callsfunc).length === 0;