Skip to main content

reset

method assert.CallTracker.prototype.reset
Jump to headingCallTracker.prototype.reset(fn?: Function): void

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
assert.strictEqual(tracker.getCalls(callsfunc).length, 1);

tracker.reset(callsfunc);
assert.strictEqual(tracker.getCalls(callsfunc).length, 0);

Parameters Jump to heading

optional
Jump to headingfn: Function

a tracked function to reset.

Return Type Jump to heading

void
Back to top