UNPKG

archunit

Version:

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

37 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extendJasmineMatchers = void 0; const result_factory_1 = require("../common/result-factory"); const violation_factory_1 = require("../common/violation-factory"); function extendJasmineMatchers() { // Check if we're in a Jasmine environment before extending if (typeof jasmine !== 'undefined') { const jasmineObj = jasmine; const beforeEachFn = globalThis.beforeEach; if (jasmineObj.addMatchers && beforeEachFn) { beforeEachFn(() => { jasmineObj.addMatchers({ toPassAsync: () => ({ compare: async (checkable, options) => { if (!checkable) { return { pass: false, message: '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)); const result = result_factory_1.ResultFactory.result(false, testViolations); return { pass: result.pass, message: result.message(), }; }, }), }); }); } } } exports.extendJasmineMatchers = extendJasmineMatchers; //# sourceMappingURL=jasmine-adapter.js.map