archunit
Version:
ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app
23 lines • 1.05 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.extendJestMatchers = void 0;
const result_factory_1 = require("../common/result-factory");
const violation_factory_1 = require("../common/violation-factory");
function extendJestMatchers() {
// Check if we're in a Jest environment (not Vitest)
if (typeof expect === 'undefined' || !expect.extend || typeof jest === 'undefined') {
return;
}
expect.extend({
async toPassAsync(checkable, options) {
if (!checkable) {
return result_factory_1.ResultFactory.error('expected something checkable as an argument for expect()');
}
const violations = await checkable.check(options);
const testViolations = violations.map((v) => violation_factory_1.ViolationFactory.from(v));
return result_factory_1.ResultFactory.result(Boolean(this.isNot), testViolations);
},
});
}
exports.extendJestMatchers = extendJestMatchers;
//# sourceMappingURL=jest-adapter.js.map
;