Node.js の MockTracker API は、テスト環境でモックオブジェクトを追跡・管理する手段を提供します。
import { mock } from 'node:test';
const fn = mock.fn();
fn(1,2,3); // does nothing... but
console.log(fn.mock.callCount()); // Records how many times it was called
console.log(fn.mock.calls[0].arguments); // Records the arguments that were passed each callMockTracker API の全体は、Node.js の MockTracker ドキュメント ↗ に記載されています。
Workers の MockTracker 実装には、現時点で Node.js の mock timers API ↗ の実装は含まれません。