UNPKG

archunit

Version:

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

47 lines (44 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.jasmineMatcher = void 0; const result_factory_1 = require("../common/result-factory"); const violation_factory_1 = require("../common/violation-factory"); exports.jasmineMatcher = { 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(), }; }, }), }; // Not working /* export function extendJasmineMatchers(force: boolean = true) { // Unless we force it, only apply extend logic if its a jasmine project if (!force && !isJasmineProject()) { return; } const jasmineObj = jasmine as unknown as { addMatchers?: (matchers: Record<string, unknown>) => void; }; const beforeEachFn = ( globalThis as unknown as { beforeEach?: (fn: () => void) => void } ).beforeEach; if (jasmineObj && beforeEachFn) { beforeEachFn(() => { jasmineObj.addMatchers!(jasmineMatcher); } } */ //# sourceMappingURL=jasmine-adapter.js.map