UNPKG

archunit

Version:

ArchUnit TypeScript is an architecture testing library, to specify and assert architecture rules in your TypeScript app

25 lines 1.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extendJestMatchers = extendJestMatchers; const result_factory_1 = require("../common/result-factory"); const violation_factory_1 = require("../common/violation-factory"); function isJestProject() { return typeof jest !== 'undefined'; } function extendJestMatchers(force = true) { // Unless we force it, only apply extend logic if its a jest project if (!force && !isJestProject()) { 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); }, }); } //# sourceMappingURL=jest-adapter.js.map