@@ -249,7 +249,7 @@ const tracker = new assert.CallTracker();
249249function func () {}
250250
251251// callsfunc() must be called exactly 1 time before tracker.verify().
252- const callsfunc = tracker .calls (func, 1 );
252+ const callsfunc = tracker .calls ({ fn : func, exact : 1 } );
253253
254254callsfunc ();
255255
@@ -268,7 +268,7 @@ const tracker = new assert.CallTracker();
268268function func () {}
269269
270270// callsfunc() must be called exactly 1 time before tracker.verify().
271- const callsfunc = tracker .calls (func, 1 );
271+ const callsfunc = tracker .calls ({ fn : func, exact : 1 } );
272272
273273callsfunc ();
274274
@@ -279,16 +279,17 @@ process.on('exit', () => {
279279});
280280```
281281
282- ### ` tracker.calls([fn][, exact] ) `
282+ ### ` tracker.calls(options ) `
283283
284284<!-- YAML
285285added:
286286 - v14.2.0
287287 - v12.19.0
288288-->
289289
290- * ` fn ` {Function} ** Default:** A no-op function.
291- * ` exact ` {number} ** Default:** ` 1 ` .
290+ * ` options ` {Object}
291+ * ` fn ` {Function} ** Default:** A no-op function.
292+ * ` exact ` {number} ** Default:** ` 1 ` .
292293* Returns: {Function} that wraps ` fn ` .
293294
294295The wrapper function is expected to be called exactly ` exact ` times. If the
@@ -306,7 +307,7 @@ function func() {}
306307
307308// Returns a function that wraps func() that must be called exact times
308309// before tracker.verify().
309- const callsfunc = tracker .calls (func);
310+ const callsfunc = tracker .calls ({ fn : func } );
310311```
311312
312313``` cjs
@@ -319,7 +320,7 @@ function func() {}
319320
320321// Returns a function that wraps func() that must be called exact times
321322// before tracker.verify().
322- const callsfunc = tracker .calls (func);
323+ const callsfunc = tracker .calls ({ fn : func } );
323324```
324325
325326### ` tracker.report() `
@@ -355,7 +356,7 @@ function foo() {}
355356
356357// Returns a function that wraps func() that must be called exact times
357358// before tracker.verify().
358- const callsfunc = tracker .calls (func, 2 );
359+ const callsfunc = tracker .calls ({ fn : func, exact : 2 } );
359360
360361// Returns an array containing information on callsfunc()
361362tracker .report ();
@@ -383,7 +384,7 @@ function foo() {}
383384
384385// Returns a function that wraps func() that must be called exact times
385386// before tracker.verify().
386- const callsfunc = tracker .calls (func, 2 );
387+ const callsfunc = tracker .calls ({ fn : func, exact : 2 } );
387388
388389// Returns an array containing information on callsfunc()
389390tracker .report ();
@@ -421,7 +422,7 @@ function func() {}
421422
422423// Returns a function that wraps func() that must be called exact times
423424// before tracker.verify().
424- const callsfunc = tracker .calls (func, 2 );
425+ const callsfunc = tracker .calls ({ fn : func, exact : 2 } );
425426
426427callsfunc ();
427428
@@ -439,7 +440,7 @@ function func() {}
439440
440441// Returns a function that wraps func() that must be called exact times
441442// before tracker.verify().
442- const callsfunc = tracker .calls (func, 2 );
443+ const callsfunc = tracker .calls ({ fn : func, exact : 2 } );
443444
444445callsfunc ();
445446
@@ -2475,7 +2476,7 @@ argument.
24752476[ `assert.throws()` ] : #assertthrowsfn-error-message
24762477[ `getColorDepth()` ] : tty.md#writestreamgetcolordepthenv
24772478[ `process.on('exit')` ] : process.md#event-exit
2478- [ `tracker.calls()` ] : #trackercallsfn-exact
2479+ [ `tracker.calls()` ] : #trackercallsoptions
24792480[ `tracker.verify()` ] : #trackerverify
24802481[ enumerable "own" properties ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Enumerability_and_ownership_of_properties
24812482[ prototype-spec ] : https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots
0 commit comments