Node.js assert tracker.report() Function
The tracker.report() method is used to get information about the expected and actual number of calls of the functions that have not been called the expected number of times.
This function returns a JavaScript object containing complete details of the expected and actual number of calls with a stack trace.
Syntax:
tracker.report()
Parameters: This function takes no parameters
Return Value: It returns an object containing complete details of expected and actual number of calls with a stack trace.
Example 1:
Javascript
const assert = require( 'assert' );
const tracker = new assert.CallTracker();
function func() {}
const callsfunc = tracker.calls(func, 2);
console.log(tracker.report());
|
Output:
Example 2:
Javascript
const assert = require( 'assert' );
const tracker = new assert.CallTracker();
function func() {}
const callsfunc = tracker.calls(func, 2);
callsfunc();
console.log(tracker.report());
|
Output:
Reference:https://nodejs.org/api/assert.html#assert_tracker_report
Last Updated :
17 Mar, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...