UNPKG

@mmisty/cypress-allure-adapter

Version:

cypress allure adapter to generate allure results during tests execution (Allure TestOps compatible)

38 lines (37 loc) 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addGherkin = void 0; const tags_1 = require("@mmisty/cypress-tags/utils/tags"); const addGherkin = () => { const originalDesc = describe; const originalDescSkip = describe.skip; const originalDescOnly = describe.only; const getTags = (test) => { var _a, _b, _c, _d, _e, _f; // this is tags support for @badeball/cypress-cucumber-preprocessor // for other plugins need to get tags separately const tagsStored = (_e = (_d = (_c = (_b = (_a = test._testConfig) === null || _a === void 0 ? void 0 : _a.env) === null || _b === void 0 ? void 0 : _b.__cypress_cucumber_preprocessor_dont_use_this_spec) === null || _c === void 0 ? void 0 : _c.pickle) === null || _d === void 0 ? void 0 : _d.tags) !== null && _e !== void 0 ? _e : []; const existingTags = (_f = test.tags) !== null && _f !== void 0 ? _f : []; // __ replace to space for descriptions const cucumberTags = tagsStored.map(t => (0, tags_1.parseInlineTags)(t.name.replace(/__/g, ' '))[0]); return tagsStored.length > 0 ? [...existingTags, ...cucumberTags] : existingTags; }; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const parseTags = original => // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore function (...args) { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore const suite = original(...args); suite.eachTest((test) => { test.tags = getTags(test); }); return suite; }; global.describe = parseTags(originalDesc); global.describe.skip = parseTags(originalDescSkip); global.describe.only = parseTags(originalDescOnly); }; exports.addGherkin = addGherkin;