(fn === @undefined) fn = noop; validateUint32(expected, "expected", !0); let context = new CallTrackerContext({ expected, stackTrace: Error(), name: fn.name || "calls" }), tracked = new Proxy(fn, { __proto__: null, apply(fn2, thisArg, argList) { return context.track(thisArg, argList), fn2.@apply(thisArg, argList); } }); return this.#callChecks.add(context), this.#trackedFunctions.set(tracked, context), tracked; } report() { let errors = []; for (let context of this.#callChecks) { let message = context.report(); if (message !== @undefined) ArrayPrototypePush.@call(errors, message); } return errors; } verify() { let errors = this.report(); if (errors.length === 0) return; let message = errors.length === 1 ? errors[0].message : "Functions were not called the expected number of times"; throw new AssertionError({ message, details: errors }); } } $ = CallTracker; return $})