Skip to main content
assert.CallTracker.prototype.reset - assert - Node documentation
method assert.CallTracker.prototype.reset

Usage in Deno

import assert from "node:assert";
CallTracker.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

optional
fn: Function

a tracked function to reset.

Return Type

void
Back to top