verify
Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that have not been called the expected number of times.
import assert from 'node:assert';
// Creates call tracker.
const tracker = new assert.CallTracker();
function func() {}
// Returns a function that wraps func() that must be called exact times
// before tracker.verify().
const callsfunc = tracker.calls(func, 2);
callsfunc();
// Will throw an error since callsfunc() was only called once.
tracker.verify();
Content copied to clipboard
Since
v14.2.0, v12.19.0