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

Usage in Deno

import assert from "node:assert";
CallTracker.prototype.report(): CallTrackerReportInformation[]

The arrays contains information about the expected and actual number of calls of the 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);

// Returns an array containing information on callsfunc()
console.log(tracker.report());
// [
//  {
//    message: 'Expected the func function to be executed 2 time(s) but was
//    executed 0 time(s).',
//    actual: 0,
//    expected: 2,
//    operator: 'func',
//    stack: stack trace
//  }
// ]

Return Type

An array of objects containing information about the wrapper functions returned by tracker.calls().

Back to top