Skip to main content
default.CallTracker.prototype.calls - node__assert.d.ts - Node documentation
method default.CallTracker.prototype.calls

Usage in Deno

```typescript import mod from "node:node__assert.d.ts"; ```
CallTracker.prototype.calls(exact?: number): () => void
The wrapper function is expected to be called exactly `exact` times. If the function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an error. ```js 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); ```

Parameters

optional
exact: number = 1

Return Type

() => void
A function that wraps `fn`.
CallTracker.prototype.calls<Func extends (...args: any[]) => any>(
fn?: Func,
exact?: number,
): Func

Type Parameters

Func extends (...args: any[]) => any

Parameters

optional
fn: Func
optional
exact: number

Return Type