@typed/test
Version:
Simple test framework
32 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var equal_1 = require("./equal");
var notEqual_1 = require("./notEqual");
var notOk_1 = require("./notOk");
var ok_1 = require("./ok");
var rejects_1 = require("./rejects");
var same_1 = require("./same");
var throws_1 = require("./throws");
function createAssertionsEnvironment() {
var stats = { count: 0 };
var assertions = {
equal: wrapAssertionInProxy(equal_1.equal, stats),
notEqual: wrapAssertionInProxy(notEqual_1.notEqual, stats),
notOk: wrapAssertionInProxy(notOk_1.notOk, stats),
ok: wrapAssertionInProxy(ok_1.ok, stats),
rejects: wrapAssertionInProxy(rejects_1.rejects, stats),
same: wrapAssertionInProxy(same_1.same, stats),
throws: wrapAssertionInProxy(throws_1.throws, stats),
};
return { stats: stats, assertions: assertions };
}
exports.createAssertionsEnvironment = createAssertionsEnvironment;
function wrapAssertionInProxy(fn, stats) {
return new Proxy(fn, {
apply: function (target, that, args) {
stats.count++;
return target.apply(that, args);
},
});
}
//# sourceMappingURL=createAssertionsEnvironment.js.map