UNPKG

@typed/test

Version:
29 lines 1.02 kB
import { equal } from './equal'; import { notEqual } from './notEqual'; import { notOk } from './notOk'; import { ok } from './ok'; import { rejects } from './rejects'; import { same } from './same'; import { throws } from './throws'; export function createAssertionsEnvironment() { var stats = { count: 0 }; var assertions = { equal: wrapAssertionInProxy(equal, stats), notEqual: wrapAssertionInProxy(notEqual, stats), notOk: wrapAssertionInProxy(notOk, stats), ok: wrapAssertionInProxy(ok, stats), rejects: wrapAssertionInProxy(rejects, stats), same: wrapAssertionInProxy(same, stats), throws: wrapAssertionInProxy(throws, stats), }; return { stats: stats, assertions: assertions }; } function wrapAssertionInProxy(fn, stats) { return new Proxy(fn, { apply: function (target, that, args) { stats.count++; return target.apply(that, args); }, }); } //# sourceMappingURL=createAssertionsEnvironment.js.map