UNPKG

@serenity-js/cucumber

Version:

Serenity/JS test runner adapter for seamless integration with any version of Cucumber.js, facilitating BDD-style test automation and leveraging Serenity/JS reporting capabilities

33 lines 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createListener = createListener; const core_1 = require("@serenity-js/core"); const gherkin_1 = require("./gherkin"); const notifier_1 = require("./notifier"); const Gherkin = require("gherkin"); /** * Creates a listener for Cucumber.js 0.x-6.x * * @param serenity * @param moduleLoader */ function createListener(serenity, moduleLoader) { const version = moduleLoader.versionOf('cucumber'); try { const cucumber = moduleLoader.require('cucumber'), notifier = new notifier_1.Notifier(serenity), mapper = new gherkin_1.FeatureFileMapper(), resultMapper = new notifier_1.ResultMapper(serenity), cache = new gherkin_1.Cache(), loader = new gherkin_1.FeatureFileLoader(new gherkin_1.FeatureFileParser(new Gherkin.Parser()), mapper, cache); // eslint-disable-next-line @typescript-eslint/no-var-requires return require(`./cucumber-${version.major()}`)({ serenity, notifier, mapper, resultMapper, cache, loader, cucumber, }); } catch (error) { throw new core_1.ConfigurationError(`Cucumber version ${version.toString()} is not supported yet`, error); } } //# sourceMappingURL=index.js.map