Socket
Socket
Sign inDemoInstall

@cucumber/cucumber

Package Overview
Dependencies
Maintainers
2
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cucumber/cucumber - npm Package Compare versions

Comparing version 8.0.0-rc.1 to 8.0.0-rc.2

lib/configuration/index.d.ts

3

lib/cli/argv_parser.d.ts
import { SnippetInterface } from '../formatter/step_definition_snippet_builder/snippet_syntax';
import { PickleOrder } from './helpers';
export interface IParsedArgvFormatRerunOptions {

@@ -24,3 +25,3 @@ separator?: string;

name: string[];
order: string;
order: PickleOrder;
parallel: number;

@@ -27,0 +28,0 @@ profile: string[];

@@ -9,5 +9,5 @@ "use strict";

const gherkin_1 = require("@cucumber/gherkin");
const i18n_1 = require("./i18n");
const formatters_1 = __importDefault(require("../formatter/helpers/formatters"));
// Using require instead of import so compiled typescript will have the desired folder structure
const { version } = require('../../package.json'); // eslint-disable-line @typescript-eslint/no-var-requires
const version_1 = require("../version");
const ArgvParser = {

@@ -60,3 +60,3 @@ collect(val, memo) {

.usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')
.version(version, '-v, --version')
.version(version_1.version, '-v, --version')
.option('-b, --backtrace', 'show full backtrace for errors')

@@ -87,7 +87,11 @@ .option('-c, --config <TYPE[:PATH]>', 'specify configuration file')

.option('--world-parameters <JSON>', 'provide parameters that will be passed to the world constructor (repeatable)', ArgvParser.mergeJson('--world-parameters'), {});
program.on('--help', () => {
/* eslint-disable no-console */
console.log(' For more details please visit https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md\n');
/* eslint-enable no-console */
program.on('option:i18n-languages', () => {
console.log((0, i18n_1.getLanguages)());
process.exit();
});
program.on('option:i18n-keywords', function (isoCode) {
console.log((0, i18n_1.getKeywords)(isoCode));
process.exit();
});
program.addHelpText('afterAll', 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md');
program.parse(argv);

@@ -94,0 +98,0 @@ const options = program.opts();

@@ -1,45 +0,5 @@

import { IParsedArgvFormatOptions } from './argv_parser';
import { IPickleFilterOptions } from '../pickle_filter';
import { IRuntimeOptions } from '../runtime';
export interface IConfigurationFormat {
outputTo: string;
type: string;
}
export interface IConfiguration {
featureDefaultLanguage: string;
featurePaths: string[];
formats: IConfigurationFormat[];
formatOptions: IParsedArgvFormatOptions;
publishing: boolean;
listI18nKeywordsFor: string;
listI18nLanguages: boolean;
order: string;
parallel: number;
pickleFilterOptions: IPickleFilterOptions;
profiles: string[];
runtimeOptions: IRuntimeOptions;
shouldExitImmediately: boolean;
supportCodePaths: string[];
supportCodeRequiredModules: string[];
suppressPublishAdvertisement: boolean;
}
export interface INewConfigurationBuilderOptions {
argv: string[];
cwd: string;
}
export default class ConfigurationBuilder {
static build(options: INewConfigurationBuilderOptions): Promise<IConfiguration>;
private readonly cwd;
private readonly args;
private readonly options;
constructor({ argv, cwd }: INewConfigurationBuilderOptions);
build(): Promise<IConfiguration>;
expandPaths(unexpandedPaths: string[], defaultExtension: string): Promise<string[]>;
expandFeaturePaths(featurePaths: string[]): Promise<string[]>;
getFeatureDirectoryPaths(featurePaths: string[]): string[];
isPublishing(): boolean;
isPublishAdvertisementSuppressed(): boolean;
getFormats(): IConfigurationFormat[];
isTruthyString(s: string | undefined): boolean;
getUnexpandedFeaturePaths(): Promise<string[]>;
}
/// <reference types="node" />
import { IParsedArgv } from './argv_parser';
import { IRunConfiguration } from '../configuration';
export declare function buildConfiguration(fromArgv: IParsedArgv, env: NodeJS.ProcessEnv): Promise<IRunConfiguration>;
export declare function isTruthyString(s: string | undefined): boolean;

@@ -6,155 +6,67 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const argv_parser_1 = __importDefault(require("./argv_parser"));
const fs_1 = __importDefault(require("mz/fs"));
const path_1 = __importDefault(require("path"));
exports.isTruthyString = exports.buildConfiguration = void 0;
const option_splitter_1 = __importDefault(require("./option_splitter"));
const glob_1 = __importDefault(require("glob"));
const util_1 = require("util");
const value_checker_1 = require("../value_checker");
const DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports';
class ConfigurationBuilder {
constructor({ argv, cwd }) {
this.cwd = cwd;
const parsedArgv = argv_parser_1.default.parse(argv);
this.args = parsedArgv.args;
this.options = parsedArgv.options;
async function buildConfiguration(fromArgv, env) {
const { args, options } = fromArgv;
return {
sources: {
paths: args,
defaultDialect: options.language,
names: options.name,
tagExpression: options.tags,
order: options.order,
},
support: {
transpileWith: options.requireModule,
paths: options.require,
},
runtime: {
dryRun: options.dryRun,
failFast: options.failFast,
filterStacktraces: !options.backtrace,
parallel: options.parallel,
retry: options.retry,
retryTagFilter: options.retryTagFilter,
strict: options.strict,
worldParameters: options.worldParameters,
},
formats: {
stdout: options.format.find((option) => !option.includes(':')),
files: options.format
.filter((option) => option.includes(':'))
.reduce((mapped, item) => {
const [type, target] = option_splitter_1.default.split(item);
return {
...mapped,
[target]: type,
};
}, {}),
publish: makePublishConfig(options, env),
options: options.formatOptions,
},
};
}
exports.buildConfiguration = buildConfiguration;
function isTruthyString(s) {
if (s === undefined) {
return false;
}
static async build(options) {
const builder = new ConfigurationBuilder(options);
return await builder.build();
return s.match(/^(false|no|0)$/i) === null;
}
exports.isTruthyString = isTruthyString;
function isPublishing(options, env) {
return (options.publish ||
isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||
env.CUCUMBER_PUBLISH_TOKEN !== undefined);
}
function makePublishConfig(options, env) {
const enabled = isPublishing(options, env);
if (!enabled) {
return false;
}
async build() {
const listI18nKeywordsFor = this.options.i18nKeywords;
const listI18nLanguages = this.options.i18nLanguages;
const unexpandedFeaturePaths = await this.getUnexpandedFeaturePaths();
let featurePaths = [];
let supportCodePaths = [];
if (listI18nKeywordsFor === '' && !listI18nLanguages) {
featurePaths = await this.expandFeaturePaths(unexpandedFeaturePaths);
let unexpandedSupportCodePaths = this.options.require;
if (unexpandedSupportCodePaths.length === 0) {
unexpandedSupportCodePaths = this.getFeatureDirectoryPaths(featurePaths);
}
supportCodePaths = await this.expandPaths(unexpandedSupportCodePaths, '.@(js|mjs)');
}
return {
featureDefaultLanguage: this.options.language,
featurePaths,
formats: this.getFormats(),
formatOptions: this.options.formatOptions,
publishing: this.isPublishing(),
listI18nKeywordsFor,
listI18nLanguages,
order: this.options.order,
parallel: this.options.parallel,
pickleFilterOptions: {
cwd: this.cwd,
featurePaths: unexpandedFeaturePaths,
names: this.options.name,
tagExpression: this.options.tags,
},
profiles: this.options.profile,
runtimeOptions: {
dryRun: this.options.dryRun,
failFast: this.options.failFast,
filterStacktraces: !this.options.backtrace,
retry: this.options.retry,
retryTagFilter: this.options.retryTagFilter,
strict: this.options.strict,
worldParameters: this.options.worldParameters,
},
shouldExitImmediately: this.options.exit,
supportCodePaths,
supportCodeRequiredModules: this.options.requireModule,
suppressPublishAdvertisement: this.isPublishAdvertisementSuppressed(),
};
}
async expandPaths(unexpandedPaths, defaultExtension) {
const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
const matches = await util_1.promisify(glob_1.default)(unexpandedPath, {
absolute: true,
cwd: this.cwd,
});
const expanded = await Promise.all(matches.map(async (match) => {
if (path_1.default.extname(match) === '') {
return await util_1.promisify(glob_1.default)(`${match}/**/*${defaultExtension}`);
}
return [match];
}));
return expanded.flat();
}));
return expandedPaths.flat().map((x) => path_1.default.normalize(x));
}
async expandFeaturePaths(featurePaths) {
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
return await this.expandPaths(featurePaths, '.feature');
}
getFeatureDirectoryPaths(featurePaths) {
const featureDirs = featurePaths.map((featurePath) => {
let featureDir = path_1.default.dirname(featurePath);
let childDir;
let parentDir = featureDir;
while (childDir !== parentDir) {
childDir = parentDir;
parentDir = path_1.default.dirname(childDir);
if (path_1.default.basename(parentDir) === 'features') {
featureDir = parentDir;
break;
}
}
return path_1.default.relative(this.cwd, featureDir);
});
return [...new Set(featureDirs)];
}
isPublishing() {
return (this.options.publish ||
this.isTruthyString(process.env.CUCUMBER_PUBLISH_ENABLED) ||
process.env.CUCUMBER_PUBLISH_TOKEN !== undefined);
}
isPublishAdvertisementSuppressed() {
return (this.options.publishQuiet ||
this.isTruthyString(process.env.CUCUMBER_PUBLISH_QUIET));
}
getFormats() {
const mapping = { '': 'progress' };
this.options.format.forEach((format) => {
const [type, outputTo] = option_splitter_1.default.split(format);
mapping[outputTo] = type;
});
if (this.isPublishing()) {
const publishUrl = value_checker_1.valueOrDefault(process.env.CUCUMBER_PUBLISH_URL, DEFAULT_CUCUMBER_PUBLISH_URL);
mapping[publishUrl] = 'message';
}
return Object.keys(mapping).map((outputTo) => ({
outputTo,
type: mapping[outputTo],
}));
}
isTruthyString(s) {
if (s === undefined) {
return false;
}
return s.match(/^(false|no|0)$/i) === null;
}
async getUnexpandedFeaturePaths() {
if (this.args.length > 0) {
const nestedFeaturePaths = await Promise.all(this.args.map(async (arg) => {
const filename = path_1.default.basename(arg);
if (filename[0] === '@') {
const filePath = path_1.default.join(this.cwd, arg);
const content = await fs_1.default.readFile(filePath, 'utf8');
return content.split('\n').map((x) => x.trim());
}
return [arg];
}));
const featurePaths = nestedFeaturePaths.flat();
if (featurePaths.length > 0) {
return featurePaths.filter((x) => x !== '');
}
}
return ['features/**/*.{feature,feature.md}'];
}
return {
url: env.CUCUMBER_PUBLISH_URL,
token: env.CUCUMBER_PUBLISH_TOKEN,
};
}
exports.default = ConfigurationBuilder;
//# sourceMappingURL=configuration_builder.js.map

@@ -18,9 +18,10 @@ /// <reference types="node" />

gherkinMessageStream: Readable;
order: string;
order: PickleOrder;
pickleFilter: PickleFilter;
}
export declare type PickleOrder = 'defined' | 'random';
export declare function parseGherkinMessageStream({ cwd, eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
export declare function orderPickleIds(pickleIds: string[], order: string): void;
export declare function orderPickleIds(pickleIds: string[], order: PickleOrder): void;
export declare function isJavaScript(filePath: string): boolean;
export declare function emitMetaMessage(eventBroadcaster: EventEmitter): Promise<void>;
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {

@@ -27,0 +28,0 @@ eventBroadcaster: EventEmitter;

@@ -31,5 +31,7 @@ "use strict";

const option_splitter_1 = __importDefault(require("./option_splitter"));
const os_1 = __importDefault(require("os"));
const messages = __importStar(require("@cucumber/messages"));
const create_meta_1 = __importDefault(require("@cucumber/create-meta"));
const ci_environment_1 = __importDefault(require("@cucumber/ci-environment"));
const support_code_library_builder_1 = require("../support_code_library_builder");
const version_1 = require("../version");
async function getExpandedArgv({ argv, cwd, }) {

@@ -50,3 +52,3 @@ const { options } = argv_parser_1.default.parse(argv);

eventBroadcaster.emit('envelope', envelope);
if (value_checker_1.doesHaveValue(envelope.pickle)) {
if ((0, value_checker_1.doesHaveValue)(envelope.pickle)) {
const pickle = envelope.pickle;

@@ -59,3 +61,3 @@ const pickleId = pickle.id;

}
if (value_checker_1.doesHaveValue(envelope.parseError)) {
if ((0, value_checker_1.doesHaveValue)(envelope.parseError)) {
reject(new Error(`Parse error in '${envelope.parseError.source.uri}': ${envelope.parseError.message}`));

@@ -74,3 +76,3 @@ }

function orderPickleIds(pickleIds, order) {
let [type, seed] = option_splitter_1.default.split(order);
const [type, seed] = option_splitter_1.default.split(order);
switch (type) {

@@ -81,6 +83,9 @@ case 'defined':

if (seed === '') {
seed = Math.floor(Math.random() * 1000 * 1000).toString();
console.warn(`Random order using seed: ${seed}`);
const newSeed = Math.floor(Math.random() * 1000 * 1000).toString();
console.warn(`Random order using seed: ${newSeed}`);
(0, knuth_shuffle_seeded_1.default)(pickleIds, newSeed);
}
knuth_shuffle_seeded_1.default(pickleIds, seed);
else {
(0, knuth_shuffle_seeded_1.default)(pickleIds, seed);
}
break;

@@ -98,7 +103,24 @@ default:

exports.isJavaScript = isJavaScript;
async function emitMetaMessage(eventBroadcaster) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { version } = require('../../package.json');
async function emitMetaMessage(eventBroadcaster, env) {
const meta = {
protocolVersion: messages.version,
implementation: {
version: version_1.version,
name: 'cucumber-js',
},
cpu: {
name: os_1.default.arch(),
},
os: {
name: os_1.default.platform(),
version: os_1.default.release(),
},
runtime: {
name: 'node.js',
version: process.versions.node,
},
ci: (0, ci_environment_1.default)(env),
};
eventBroadcaster.emit('envelope', {
meta: create_meta_1.default('cucumber-js', version, process.env),
meta,
});

@@ -105,0 +127,0 @@ }

@@ -65,3 +65,3 @@ "use strict";

const words = language[keyword].map((s) => `"${s}"`).join(', ');
return [capital_case_1.capitalCase(keyword), words];
return [(0, capital_case_1.capitalCase)(keyword), words];
});

@@ -68,0 +68,0 @@ return getAsTable(['ENGLISH KEYWORD', 'NATIVE KEYWORDS'], rows);

/// <reference types="node" />
import { EventDataCollector } from '../formatter/helpers';
import { IConfiguration, IConfigurationFormat } from './configuration_builder';
import { EventEmitter } from 'events';
import { IdGenerator } from '@cucumber/messages';
import { IFormatterStream } from '../formatter';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { IParsedArgvFormatOptions } from './argv_parser';
export interface ICliRunResult {
shouldAdvertisePublish: boolean;
shouldExitImmediately: boolean;
success: boolean;
}
interface IInitializeFormattersRequest {
eventBroadcaster: EventEmitter;
eventDataCollector: EventDataCollector;
formatOptions: IParsedArgvFormatOptions;
formats: IConfigurationFormat[];
supportCodeLibrary: ISupportCodeLibrary;
}
interface IGetSupportCodeLibraryRequest {
newId: IdGenerator.NewId;
supportCodeRequiredModules: string[];
supportCodePaths: string[];
}
export default class Cli {

@@ -29,12 +12,10 @@ private readonly argv;

private readonly stdout;
constructor({ argv, cwd, stdout, }: {
private readonly env;
constructor({ argv, cwd, stdout, env, }: {
argv: string[];
cwd: string;
stdout: IFormatterStream;
env: NodeJS.ProcessEnv;
});
getConfiguration(): Promise<IConfiguration>;
initializeFormatters({ eventBroadcaster, eventDataCollector, formatOptions, formats, supportCodeLibrary, }: IInitializeFormattersRequest): Promise<() => Promise<void>>;
getSupportCodeLibrary({ newId, supportCodeRequiredModules, supportCodePaths, }: IGetSupportCodeLibraryRequest): Promise<ISupportCodeLibrary>;
run(): Promise<ICliRunResult>;
}
export {};
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {

@@ -25,185 +6,31 @@ return (mod && mod.__esModule) ? mod : { "default": mod };

Object.defineProperty(exports, "__esModule", { value: true });
const helpers_1 = require("../formatter/helpers");
const helpers_2 = require("./helpers");
const helpers_1 = require("./helpers");
const install_validator_1 = require("./install_validator");
const I18n = __importStar(require("./i18n"));
const configuration_builder_1 = __importDefault(require("./configuration_builder"));
const events_1 = require("events");
const builder_1 = __importDefault(require("../formatter/builder"));
const fs_1 = __importDefault(require("mz/fs"));
const path_1 = __importDefault(require("path"));
const pickle_filter_1 = __importDefault(require("../pickle_filter"));
const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
const runtime_1 = __importDefault(require("../runtime"));
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
const messages_1 = require("@cucumber/messages");
const value_checker_1 = require("../value_checker");
const gherkin_streams_1 = require("@cucumber/gherkin-streams");
const http_stream_1 = __importDefault(require("../formatter/http_stream"));
const util_1 = require("util");
const stream_1 = require("stream");
const url_1 = require("url");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { importer } = require('../importer');
const { uuid } = messages_1.IdGenerator;
const configuration_builder_1 = require("./configuration_builder");
const run_1 = require("../run");
const argv_parser_1 = __importDefault(require("./argv_parser"));
class Cli {
constructor({ argv, cwd, stdout, }) {
constructor({ argv, cwd, stdout, env, }) {
this.argv = argv;
this.cwd = cwd;
this.stdout = stdout;
this.env = env;
}
async getConfiguration() {
const fullArgv = await helpers_2.getExpandedArgv({
async run() {
await (0, install_validator_1.validateInstall)(this.cwd);
const fromArgv = argv_parser_1.default.parse(await (0, helpers_1.getExpandedArgv)({
argv: this.argv,
cwd: this.cwd,
});
return await configuration_builder_1.default.build({
argv: fullArgv,
}));
const configuration = await (0, configuration_builder_1.buildConfiguration)(fromArgv, this.env);
const { success } = await (0, run_1.runCucumber)(configuration, {
cwd: this.cwd,
stdout: this.stdout,
env: this.env,
});
}
async initializeFormatters({ eventBroadcaster, eventDataCollector, formatOptions, formats, supportCodeLibrary, }) {
const formatters = await Promise.all(formats.map(async ({ type, outputTo }) => {
let stream = this.stdout;
if (outputTo !== '') {
if (outputTo.match(/^https?:\/\//) !== null) {
const headers = {};
if (process.env.CUCUMBER_PUBLISH_TOKEN !== undefined) {
headers.Authorization = `Bearer ${process.env.CUCUMBER_PUBLISH_TOKEN}`;
}
stream = new http_stream_1.default(outputTo, 'GET', headers);
const readerStream = new stream_1.Writable({
objectMode: true,
write: function (responseBody, encoding, writeCallback) {
console.error(responseBody);
writeCallback();
},
});
stream.pipe(readerStream);
}
else {
const fd = await fs_1.default.open(path_1.default.resolve(this.cwd, outputTo), 'w');
stream = fs_1.default.createWriteStream(null, { fd });
}
}
stream.on('error', (error) => {
console.error(error.message);
process.exit(1);
});
const typeOptions = {
cwd: this.cwd,
eventBroadcaster,
eventDataCollector,
log: stream.write.bind(stream),
parsedArgvOptions: formatOptions,
stream,
cleanup: stream === this.stdout
? async () => await Promise.resolve()
: util_1.promisify(stream.end.bind(stream)),
supportCodeLibrary,
};
if (value_checker_1.doesNotHaveValue(formatOptions.colorsEnabled)) {
typeOptions.parsedArgvOptions.colorsEnabled = stream.isTTY;
}
if (type === 'progress-bar' && !stream.isTTY) {
const outputToName = outputTo === '' ? 'stdout' : outputTo;
console.warn(`Cannot use 'progress-bar' formatter for output to '${outputToName}' as not a TTY. Switching to 'progress' formatter.`);
type = 'progress';
}
return await builder_1.default.build(type, typeOptions);
}));
return async function () {
await Promise.all(formatters.map(async (f) => await f.finished()));
};
}
async getSupportCodeLibrary({ newId, supportCodeRequiredModules, supportCodePaths, }) {
supportCodeRequiredModules.map((module) => require(module));
support_code_library_builder_1.default.reset(this.cwd, newId);
for (const codePath of supportCodePaths) {
if (supportCodeRequiredModules.length || !helpers_2.isJavaScript(codePath)) {
require(codePath);
}
else {
await importer(url_1.pathToFileURL(codePath));
}
}
return support_code_library_builder_1.default.finalize();
}
async run() {
await install_validator_1.validateInstall(this.cwd);
const configuration = await this.getConfiguration();
if (configuration.listI18nLanguages) {
this.stdout.write(I18n.getLanguages());
return { shouldExitImmediately: true, success: true };
}
if (configuration.listI18nKeywordsFor !== '') {
this.stdout.write(I18n.getKeywords(configuration.listI18nKeywordsFor));
return { shouldExitImmediately: true, success: true };
}
const newId = uuid();
const supportCodeLibrary = await this.getSupportCodeLibrary({
newId,
supportCodePaths: configuration.supportCodePaths,
supportCodeRequiredModules: configuration.supportCodeRequiredModules,
});
const eventBroadcaster = new events_1.EventEmitter();
const eventDataCollector = new helpers_1.EventDataCollector(eventBroadcaster);
const cleanup = await this.initializeFormatters({
eventBroadcaster,
eventDataCollector,
formatOptions: configuration.formatOptions,
formats: configuration.formats,
supportCodeLibrary,
});
await helpers_2.emitMetaMessage(eventBroadcaster);
const gherkinMessageStream = gherkin_streams_1.GherkinStreams.fromPaths(configuration.featurePaths, {
defaultDialect: configuration.featureDefaultLanguage,
newId,
relativeTo: this.cwd,
});
let pickleIds = [];
if (configuration.featurePaths.length > 0) {
pickleIds = await helpers_2.parseGherkinMessageStream({
cwd: this.cwd,
eventBroadcaster,
eventDataCollector,
gherkinMessageStream,
order: configuration.order,
pickleFilter: new pickle_filter_1.default(configuration.pickleFilterOptions),
});
}
helpers_2.emitSupportCodeMessages({
eventBroadcaster,
supportCodeLibrary,
newId,
});
let success;
if (configuration.parallel > 1) {
const parallelRuntimeCoordinator = new coordinator_1.default({
cwd: this.cwd,
eventBroadcaster,
eventDataCollector,
options: configuration.runtimeOptions,
newId,
pickleIds,
supportCodeLibrary,
supportCodePaths: configuration.supportCodePaths,
supportCodeRequiredModules: configuration.supportCodeRequiredModules,
});
success = await parallelRuntimeCoordinator.run(configuration.parallel);
}
else {
const runtime = new runtime_1.default({
eventBroadcaster,
eventDataCollector,
options: configuration.runtimeOptions,
newId,
pickleIds,
supportCodeLibrary,
});
success = await runtime.start();
}
await cleanup();
return {
shouldExitImmediately: configuration.shouldExitImmediately,
shouldAdvertisePublish: !configuration.formats.publish &&
!fromArgv.options.publishQuiet &&
!(0, configuration_builder_1.isTruthyString)(this.env.CUCUMBER_PUBLISH_QUIET),
shouldExitImmediately: fromArgv.options.exit,
success,

@@ -210,0 +37,0 @@ };

@@ -19,3 +19,3 @@ "use strict";

try {
localCucumberPath = await util_1.promisify(resolve_1.default)('@cucumber/cucumber', {
localCucumberPath = await (0, util_1.promisify)(resolve_1.default)('@cucumber/cucumber', {
basedir: cwd,

@@ -22,0 +22,0 @@ });

@@ -5,2 +5,3 @@ "use strict";

split(option) {
option = option.replace(/"/g, '');
const parts = option.split(/([^A-Z]):(?!\\)/);

@@ -7,0 +8,0 @@ const result = parts.reduce((memo, part, i) => {

@@ -36,10 +36,10 @@ "use strict";

const definitions = await this.getDefinitions(configFile);
if (profiles.length === 0 && value_checker_1.doesHaveValue(definitions.default)) {
if (profiles.length === 0 && (0, value_checker_1.doesHaveValue)(definitions.default)) {
profiles = ['default'];
}
const argvs = profiles.map((profile) => {
if (value_checker_1.doesNotHaveValue(definitions[profile])) {
if ((0, value_checker_1.doesNotHaveValue)(definitions[profile])) {
throw new Error(`Undefined profile: ${profile}`);
}
return string_argv_1.default(definitions[profile]);
return (0, string_argv_1.default)(definitions[profile]);
});

@@ -46,0 +46,0 @@ return argvs.flat();

@@ -17,7 +17,7 @@ "use strict";

async function run() {
const cwd = process.cwd();
const cli = new _1.default({
argv: process.argv,
cwd,
cwd: process.cwd(),
stdout: process.stdout,
env: process.env,
});

@@ -31,4 +31,3 @@ let result;

}
const config = await cli.getConfiguration();
if (!config.publishing && !config.suppressPublishAdvertisement) {
if (result.shouldAdvertisePublish) {
displayPublishAdvertisementBanner();

@@ -35,0 +34,0 @@ }

@@ -19,3 +19,3 @@ "use strict";

const FormatterConstructor = await FormatterBuilder.getConstructorByType(type, options.cwd);
const colorFns = get_color_fns_1.default(options.parsedArgvOptions.colorsEnabled);
const colorFns = (0, get_color_fns_1.default)(options.parsedArgvOptions.colorsEnabled);
const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder({

@@ -40,7 +40,7 @@ cwd: options.cwd,

async getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }) {
if (value_checker_1.doesNotHaveValue(snippetInterface)) {
if ((0, value_checker_1.doesNotHaveValue)(snippetInterface)) {
snippetInterface = snippet_syntax_1.SnippetInterface.Synchronous;
}
let Syntax = javascript_snippet_syntax_1.default;
if (value_checker_1.doesHaveValue(snippetSyntax)) {
if ((0, value_checker_1.doesHaveValue)(snippetSyntax)) {
Syntax = await FormatterBuilder.loadCustomClass('syntax', snippetSyntax, cwd);

@@ -55,6 +55,6 @@ }

let CustomClass = descriptor.startsWith(`.`)
? await importer(url_1.pathToFileURL(path_1.default.resolve(cwd, descriptor)))
? await importer((0, url_1.pathToFileURL)(path_1.default.resolve(cwd, descriptor)))
: await importer(descriptor);
CustomClass = FormatterBuilder.resolveConstructor(CustomClass);
if (value_checker_1.doesHaveValue(CustomClass)) {
if ((0, value_checker_1.doesHaveValue)(CustomClass)) {
return CustomClass;

@@ -70,3 +70,3 @@ }

}
else if (value_checker_1.doesHaveValue(ImportedCode) &&
else if ((0, value_checker_1.doesHaveValue)(ImportedCode) &&
typeof ImportedCode.default === 'function') {

@@ -73,0 +73,0 @@ return ImportedCode.default;

@@ -60,25 +60,25 @@ "use strict";

parseEnvelope(envelope) {
if (value_checker_1.doesHaveValue(envelope.gherkinDocument)) {
if ((0, value_checker_1.doesHaveValue)(envelope.gherkinDocument)) {
this.gherkinDocumentMap[envelope.gherkinDocument.uri] =
envelope.gherkinDocument;
}
else if (value_checker_1.doesHaveValue(envelope.pickle)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.pickle)) {
this.pickleMap[envelope.pickle.id] = envelope.pickle;
}
else if (value_checker_1.doesHaveValue(envelope.undefinedParameterType)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.undefinedParameterType)) {
this.undefinedParameterTypes.push(envelope.undefinedParameterType);
}
else if (value_checker_1.doesHaveValue(envelope.testCase)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testCase)) {
this.testCaseMap[envelope.testCase.id] = envelope.testCase;
}
else if (value_checker_1.doesHaveValue(envelope.testCaseStarted)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseStarted)) {
this.initTestCaseAttempt(envelope.testCaseStarted);
}
else if (value_checker_1.doesHaveValue(envelope.attachment)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.attachment)) {
this.storeAttachment(envelope.attachment);
}
else if (value_checker_1.doesHaveValue(envelope.testStepFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
this.storeTestStepResult(envelope.testStepFinished);
}
else if (value_checker_1.doesHaveValue(envelope.testCaseFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
this.storeTestCaseResult(envelope.testCaseFinished);

@@ -103,5 +103,5 @@ }

// TODO: we shouldn't have to check if these properties have values - they are non-nullable
if (value_checker_1.doesHaveValue(testCaseStartedId) && value_checker_1.doesHaveValue(testStepId)) {
if ((0, value_checker_1.doesHaveValue)(testCaseStartedId) && (0, value_checker_1.doesHaveValue)(testStepId)) {
const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
if (value_checker_1.doesNotHaveValue(stepAttachments[testStepId])) {
if ((0, value_checker_1.doesNotHaveValue)(stepAttachments[testStepId])) {
stepAttachments[testStepId] = [];

@@ -108,0 +108,0 @@ }

@@ -15,7 +15,7 @@ "use strict";

function extractStepContainers(child) {
if (value_checker_1.doesHaveValue(child.background)) {
if ((0, value_checker_1.doesHaveValue)(child.background)) {
return [child.background];
}
else if (value_checker_1.doesHaveValue(child.rule)) {
return child.rule.children.map((ruleChild) => value_checker_1.doesHaveValue(ruleChild.background)
else if ((0, value_checker_1.doesHaveValue)(child.rule)) {
return child.rule.children.map((ruleChild) => (0, value_checker_1.doesHaveValue)(ruleChild.background)
? ruleChild.background

@@ -30,3 +30,3 @@ : ruleChild.scenario);

.map((child) => {
if (value_checker_1.doesHaveValue(child.rule)) {
if ((0, value_checker_1.doesHaveValue)(child.rule)) {
return child.rule.children;

@@ -50,3 +50,3 @@ }

.forEach((x) => x.rule.children
.filter((child) => value_checker_1.doesHaveValue(child.scenario))
.filter((child) => (0, value_checker_1.doesHaveValue)(child.scenario))
.forEach((child) => (result[child.scenario.id] = x.rule)));

@@ -62,3 +62,3 @@ return result;

locationMap[id] = scenario.location;
if (value_checker_1.doesHaveValue(scenario.examples)) {
if ((0, value_checker_1.doesHaveValue)(scenario.examples)) {
scenario.examples.forEach((x) => x.tableBody.forEach((tableRow) => (locationMap[tableRow.id] = tableRow.location)));

@@ -65,0 +65,0 @@ }

@@ -25,3 +25,3 @@ "use strict";

const prefix = `${number.toString()}) `;
const formattedTestCaseAttempt = test_case_attempt_formatter_1.formatTestCaseAttempt({
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
colorFns,

@@ -38,3 +38,3 @@ cwd,

}
return indent_string_1.default(line, prefix.length);
return (0, indent_string_1.default)(line, prefix.length);
});

@@ -41,0 +41,0 @@ return updatedLines.join('\n');

@@ -23,3 +23,3 @@ "use strict";

case 'but':
if (value_checker_1.doesHaveValue(previousKeywordType)) {
if ((0, value_checker_1.doesHaveValue)(previousKeywordType)) {
return previousKeywordType;

@@ -26,0 +26,0 @@ }

@@ -11,3 +11,3 @@ "use strict";

let uri = obj.uri;
if (value_checker_1.doesHaveValue(cwd)) {
if ((0, value_checker_1.doesHaveValue)(cwd)) {
uri = path_1.default.relative(cwd, uri);

@@ -14,0 +14,0 @@ }

@@ -24,3 +24,3 @@ "use strict";

function getPickleLocation({ gherkinDocument, pickle, }) {
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
return gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]];

@@ -27,0 +27,0 @@ }

@@ -42,3 +42,3 @@ "use strict";

function formatStepArgument(arg) {
return step_arguments_1.parseStepArgument(arg, {
return (0, step_arguments_1.parseStepArgument)(arg, {
dataTable: formatDataTable,

@@ -45,0 +45,0 @@ docString: formatDocString,

@@ -48,3 +48,3 @@ "use strict";

testCase.testSteps.forEach((testStep) => {
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
testStepResults.push(stepResults[testStep.id]);

@@ -51,0 +51,0 @@ }

@@ -47,3 +47,3 @@ "use strict";

case messages.TestStepResultStatus.UNDEFINED:
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${indent_string_1.default(testStep.snippet, 2)}\n`;
return `${'Undefined. Implement with the following snippet:' + '\n\n'}${(0, indent_string_1.default)(testStep.snippet, 2)}\n`;
case messages.TestStepResultStatus.PENDING:

@@ -57,19 +57,19 @@ return 'Pending';

const colorFn = colorFns.forStatus(status);
const identifier = testStep.keyword + value_checker_1.valueOrDefault(testStep.text, '');
const identifier = testStep.keyword + (0, value_checker_1.valueOrDefault)(testStep.text, '');
let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`);
if (value_checker_1.doesHaveValue(actionLocation)) {
text += ` # ${colorFns.location(location_helpers_1.formatLocation(actionLocation))}`;
if ((0, value_checker_1.doesHaveValue)(actionLocation)) {
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(actionLocation))}`;
}
text += '\n';
if (value_checker_1.doesHaveValue(testStep.argument)) {
const argumentsText = step_argument_formatter_1.formatStepArgument(testStep.argument);
text += indent_string_1.default(`${colorFn(argumentsText)}\n`, 4);
if ((0, value_checker_1.doesHaveValue)(testStep.argument)) {
const argumentsText = (0, step_argument_formatter_1.formatStepArgument)(testStep.argument);
text += (0, indent_string_1.default)(`${colorFn(argumentsText)}\n`, 4);
}
attachments.forEach(({ body, mediaType }) => {
const message = mediaType === 'text/plain' ? `: ${body}` : '';
text += indent_string_1.default(`Attachment (${mediaType})${message}\n`, 4);
text += (0, indent_string_1.default)(`Attachment (${mediaType})${message}\n`, 4);
});
const message = getStepMessage(testStep);
if (message !== '') {
text += `${indent_string_1.default(colorFn(message), 4)}\n`;
text += `${(0, indent_string_1.default)(colorFn(message), 4)}\n`;
}

@@ -79,3 +79,3 @@ return text;

function formatTestCaseAttempt({ colorFns, cwd, snippetBuilder, supportCodeLibrary, testCaseAttempt, }) {
const parsed = test_case_attempt_parser_1.parseTestCaseAttempt({
const parsed = (0, test_case_attempt_parser_1.parseTestCaseAttempt)({
cwd,

@@ -88,3 +88,3 @@ snippetBuilder,

text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried);
text += ` # ${colorFns.location(location_helpers_1.formatLocation(parsed.testCase.sourceLocation))}\n`;
text += ` # ${colorFns.location((0, location_helpers_1.formatLocation)(parsed.testCase.sourceLocation))}\n`;
parsed.testSteps.forEach((testStep) => {

@@ -91,0 +91,0 @@ text += formatStep({ colorFns, testStep });

@@ -32,3 +32,3 @@ "use strict";

attachments: testStepAttachments,
keyword: value_checker_1.doesHaveValue(testStep.pickleStepId)
keyword: (0, value_checker_1.doesHaveValue)(testStep.pickleStepId)
? keyword

@@ -40,3 +40,3 @@ : isBeforeHook

};
if (value_checker_1.doesHaveValue(testStep.hookId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
let hookDefinition;

@@ -54,3 +54,3 @@ if (isBeforeHook) {

}
if (value_checker_1.doesHaveValue(testStep.stepDefinitionIds) &&
if ((0, value_checker_1.doesHaveValue)(testStep.stepDefinitionIds) &&
testStep.stepDefinitionIds.length === 1) {

@@ -63,3 +63,3 @@ const stepDefinition = supportCodeLibrary.stepDefinitions.find((x) => x.id === testStep.stepDefinitionIds[0]);

}
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
out.sourceLocation = {

@@ -70,3 +70,3 @@ uri: pickleUri,

out.text = pickleStep.text;
if (value_checker_1.doesHaveValue(pickleStep.argument)) {
if ((0, value_checker_1.doesHaveValue)(pickleStep.argument)) {
out.argument = pickleStep.argument;

@@ -84,5 +84,5 @@ }

const { testCase, pickle, gherkinDocument } = testCaseAttempt;
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(gherkinDocument);
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
const pickleStepMap = pickle_parser_1.getPickleStepMap(pickle);
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(gherkinDocument);
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(pickle);
const relativePickleUri = pickle.uri;

@@ -103,8 +103,8 @@ const parsedTestCase = {

const testStepResult = testCaseAttempt.stepResults[testStep.id] || new messages_1.TestStepResult();
isBeforeHook = isBeforeHook && value_checker_1.doesHaveValue(testStep.hookId);
isBeforeHook = isBeforeHook && (0, value_checker_1.doesHaveValue)(testStep.hookId);
let keyword, keywordType, pickleStep;
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
pickleStep = pickleStepMap[testStep.pickleStepId];
keyword = pickle_parser_1.getStepKeyword({ pickleStep, gherkinStepMap });
keywordType = keyword_type_1.getStepKeywordType({
keyword = (0, pickle_parser_1.getStepKeyword)({ pickleStep, gherkinStepMap });
keywordType = (0, keyword_type_1.getStepKeywordType)({
keyword,

@@ -126,3 +126,3 @@ language: gherkinDocument.feature.language,

testStepResult,
testStepAttachments: value_checker_1.valueOrDefault(testCaseAttempt.stepAttachments[testStep.id], []),
testStepAttachments: (0, value_checker_1.valueOrDefault)(testCaseAttempt.stepAttachments[testStep.id], []),
});

@@ -129,0 +129,0 @@ parsedTestSteps.push(parsedStep);

@@ -49,6 +49,6 @@ "use strict";

eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
const pickleStepMap = pickle_parser_1.getPickleStepMap(testCaseAttempt.pickle);
const gherkinStepMap = gherkin_document_parser_1.getGherkinStepMap(testCaseAttempt.gherkinDocument);
const pickleStepMap = (0, pickle_parser_1.getPickleStepMap)(testCaseAttempt.pickle);
const gherkinStepMap = (0, gherkin_document_parser_1.getGherkinStepMap)(testCaseAttempt.gherkinDocument);
testCaseAttempt.testCase.testSteps.forEach((testStep) => {
if (value_checker_1.doesHaveValue(testStep.pickleStepId) &&
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId) &&
testStep.stepDefinitionIds.length === 1) {

@@ -64,6 +64,6 @@ const stepDefinitionId = testStep.stepDefinitionIds[0];

const { duration, status } = testCaseAttempt.stepResults[testStep.id];
if (!unexecutedStatuses.includes(status) && value_checker_1.doesHaveValue(duration)) {
if (!unexecutedStatuses.includes(status) && (0, value_checker_1.doesHaveValue)(duration)) {
match.duration = duration;
}
if (value_checker_1.doesHaveValue(mapping[stepDefinitionId])) {
if ((0, value_checker_1.doesHaveValue)(mapping[stepDefinitionId])) {
mapping[stepDefinitionId].matches.push(match);

@@ -70,0 +70,0 @@ }

@@ -15,8 +15,8 @@ "use strict";

super(options);
const cucumberHtmlStream = new html_formatter_1.default(resolve_pkg_1.default('@cucumber/html-formatter', { cwd: __dirname }) +
'/dist/main.css', resolve_pkg_1.default('@cucumber/html-formatter', { cwd: __dirname }) +
const cucumberHtmlStream = new html_formatter_1.default((0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
'/dist/main.css', (0, resolve_pkg_1.default)('@cucumber/html-formatter', { cwd: __dirname }) +
'/dist/main.js');
options.eventBroadcaster.on('envelope', (envelope) => {
cucumberHtmlStream.write(envelope);
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
cucumberHtmlStream.end();

@@ -26,3 +26,3 @@ }

cucumberHtmlStream.on('data', (chunk) => this.log(chunk));
this._finished = util_1.promisify(stream_1.finished)(cucumberHtmlStream);
this._finished = (0, util_1.promisify)(stream_1.finished)(cucumberHtmlStream);
}

@@ -29,0 +29,0 @@ async finished() {

@@ -34,3 +34,3 @@ "use strict";

tmp_1.default.file((err, name, fd) => {
if (value_checker_1.doesHaveValue(err))
if ((0, value_checker_1.doesHaveValue)(err))
return callback(err);

@@ -49,3 +49,3 @@ this.tempFilePath = name;

this.sendHttpRequest(this.url, this.method, this.headers, (err1, res1) => {
if (value_checker_1.doesHaveValue(err1))
if ((0, value_checker_1.doesHaveValue)(err1))
return callback(err1);

@@ -57,3 +57,3 @@ this.pushResponseBody(res1, () => {

this.sendHttpRequest(res1.headers.location, 'PUT', {}, (err2, res2) => {
if (value_checker_1.doesHaveValue(err2))
if ((0, value_checker_1.doesHaveValue)(err2))
return callback(err2);

@@ -86,3 +86,3 @@ this.emitErrorUnlessHttp2xx(res2, this.url, this.method);

sendHttpRequest(url, method, headers, callback) {
const httpx = value_checker_1.doesHaveValue(url.match(/^https:/)) ? https_1.default : http_1.default;
const httpx = (0, value_checker_1.doesHaveValue)(url.match(/^https:/)) ? https_1.default : http_1.default;
const additionalHttpHeaders = {};

@@ -104,4 +104,4 @@ const upload = method === 'PUT' || method === 'POST';

if (upload) {
stream_1.pipeline(fs_1.default.createReadStream(this.tempFilePath), req, (err) => {
if (value_checker_1.doesHaveValue(err)) {
(0, stream_1.pipeline)(fs_1.default.createReadStream(this.tempFilePath), req, (err) => {
if ((0, value_checker_1.doesHaveValue)(err)) {
this.emit('error', err);

@@ -108,0 +108,0 @@ }

@@ -37,3 +37,3 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.onTestRunFinished();

@@ -60,7 +60,7 @@ }

formatStepArgument(stepArgument, gherkinStep) {
if (value_checker_1.doesNotHaveValue(stepArgument)) {
if ((0, value_checker_1.doesNotHaveValue)(stepArgument)) {
return [];
}
return [
step_arguments_1.parseStepArgument(stepArgument, {
(0, step_arguments_1.parseStepArgument)(stepArgument, {
dataTable: (dataTable) => this.formatDataTable(dataTable),

@@ -78,3 +78,3 @@ docString: (docString) => this.formatDocString(docString, gherkinStep),

const uri = testCaseAttempt.pickle.uri;
if (value_checker_1.doesNotHaveValue(groupedTestCaseAttempts[uri])) {
if ((0, value_checker_1.doesNotHaveValue)(groupedTestCaseAttempts[uri])) {
groupedTestCaseAttempts[uri] = [];

@@ -90,4 +90,4 @@ }

const gherkinScenarioMap = getGherkinScenarioMap(gherkinDocument);
const gherkinExampleRuleMap = gherkin_document_parser_1.getGherkinExampleRuleMap(gherkinDocument);
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
const gherkinExampleRuleMap = (0, gherkin_document_parser_1.getGherkinExampleRuleMap)(gherkinDocument);
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
const elements = group.map((testCaseAttempt) => {

@@ -98,3 +98,3 @@ const { pickle } = testCaseAttempt;

const steps = testCaseAttempt.testCase.testSteps.map((testStep) => {
isBeforeHook = isBeforeHook && !value_checker_1.doesHaveValue(testStep.pickleStepId);
isBeforeHook = isBeforeHook && !(0, value_checker_1.doesHaveValue)(testStep.pickleStepId);
return this.getStepData({

@@ -157,3 +157,3 @@ isBeforeHook,

const rule = gherkinExampleRuleMap[pickle.astNodeIds[0]];
if (value_checker_1.doesHaveValue(rule)) {
if ((0, value_checker_1.doesHaveValue)(rule)) {
parts = [feature, rule, pickle];

@@ -168,3 +168,3 @@ }

const data = {};
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
const pickleStep = pickleStepMap[testStep.pickleStepId];

@@ -180,6 +180,6 @@ data.arguments = this.formatStepArgument(pickleStep.argument, gherkinStepMap[pickleStep.astNodeIds[0]]);

}
if (value_checker_1.doesHaveValue(testStep.stepDefinitionIds) &&
if ((0, value_checker_1.doesHaveValue)(testStep.stepDefinitionIds) &&
testStep.stepDefinitionIds.length === 1) {
const stepDefinition = this.supportCodeLibrary.stepDefinitions.find((s) => s.id === testStep.stepDefinitionIds[0]);
data.match = { location: helpers_1.formatLocation(stepDefinition) };
data.match = { location: (0, helpers_1.formatLocation)(stepDefinition) };
}

@@ -190,3 +190,3 @@ const { message, status } = testStepResult;

};
if (value_checker_1.doesHaveValue(testStepResult.duration)) {
if ((0, value_checker_1.doesHaveValue)(testStepResult.duration)) {
data.result.duration =

@@ -196,3 +196,3 @@ messages.TimeConversion.durationToMilliseconds(testStepResult.duration) * 1000000;

if (status === messages.TestStepResultStatus.FAILED &&
value_checker_1.doesHaveValue(message)) {
(0, value_checker_1.doesHaveValue)(message)) {
data.result.error_message = message;

@@ -199,0 +199,0 @@ }

@@ -25,3 +25,3 @@ "use strict";

initializeProgressBar() {
if (value_checker_1.doesHaveValue(this.progressBar)) {
if ((0, value_checker_1.doesHaveValue)(this.progressBar)) {
return;

@@ -34,3 +34,3 @@ }

total: this.numberOfSteps,
width: value_checker_1.valueOrDefault(this.stream.columns, 80),
width: (0, value_checker_1.valueOrDefault)(this.stream.columns, 80),
});

@@ -41,3 +41,3 @@ }

const testStep = testCase.testSteps.find((s) => s.id === testStepId);
if (value_checker_1.doesHaveValue(testStep.pickleStepId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
this.progressBar.tick();

@@ -47,10 +47,10 @@ }

logUndefinedParametertype(parameterType) {
this.log(`Undefined parameter type: ${issue_helpers_1.formatUndefinedParameterType(parameterType)}\n`);
this.log(`Undefined parameter type: ${(0, issue_helpers_1.formatUndefinedParameterType)(parameterType)}\n`);
}
logErrorIfNeeded(testCaseFinished) {
const { worstTestStepResult } = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
if (helpers_1.isIssue(worstTestStepResult)) {
if ((0, helpers_1.isIssue)(worstTestStepResult)) {
this.issueCount += 1;
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
this.progressBar.interrupt(helpers_1.formatIssue({
this.progressBar.interrupt((0, helpers_1.formatIssue)({
colorFns: this.colorFns,

@@ -70,4 +70,4 @@ cwd: this.cwd,

logSummary(testRunFinished) {
const testRunDuration = time_1.durationBetweenTimestamps(this.testRunStarted.timestamp, testRunFinished.timestamp);
this.log(helpers_1.formatSummary({
const testRunDuration = (0, time_1.durationBetweenTimestamps)(this.testRunStarted.timestamp, testRunFinished.timestamp);
this.log((0, helpers_1.formatSummary)({
colorFns: this.colorFns,

@@ -79,21 +79,21 @@ testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(),

parseEnvelope(envelope) {
if (value_checker_1.doesHaveValue(envelope.undefinedParameterType)) {
if ((0, value_checker_1.doesHaveValue)(envelope.undefinedParameterType)) {
this.logUndefinedParametertype(envelope.undefinedParameterType);
}
else if (value_checker_1.doesHaveValue(envelope.testCase)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testCase)) {
this.incrementStepCount(envelope.testCase.pickleId);
}
else if (value_checker_1.doesHaveValue(envelope.testStepStarted)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepStarted)) {
this.initializeProgressBar();
}
else if (value_checker_1.doesHaveValue(envelope.testStepFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
this.logProgress(envelope.testStepFinished);
}
else if (value_checker_1.doesHaveValue(envelope.testCaseFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
this.logErrorIfNeeded(envelope.testCaseFinished);
}
else if (value_checker_1.doesHaveValue(envelope.testRunStarted)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testRunStarted)) {
this.testRunStarted = envelope.testRunStarted;
}
else if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.logSummary(envelope.testRunFinished);

@@ -100,0 +100,0 @@ }

@@ -39,6 +39,6 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.log('\n\n');
}
else if (value_checker_1.doesHaveValue(envelope.testStepFinished)) {
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
this.logProgress(envelope.testStepFinished);

@@ -45,0 +45,0 @@ }

@@ -34,8 +34,8 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.logFailedTestCases();
}
});
const rerunOptions = value_checker_1.valueOrDefault(options.parsedArgvOptions.rerun, {});
this.separator = value_checker_1.valueOrDefault(rerunOptions.separator, DEFAULT_SEPARATOR);
const rerunOptions = (0, value_checker_1.valueOrDefault)(options.parsedArgvOptions.rerun, {});
this.separator = (0, value_checker_1.valueOrDefault)(rerunOptions.separator, DEFAULT_SEPARATOR);
}

@@ -49,4 +49,4 @@ logFailedTestCases() {

const relativeUri = pickle.uri;
const line = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument)[pickle.astNodeIds[pickle.astNodeIds.length - 1]].line;
if (value_checker_1.doesNotHaveValue(mapping[relativeUri])) {
const line = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument)[pickle.astNodeIds[pickle.astNodeIds.length - 1]].line;
if ((0, value_checker_1.doesNotHaveValue)(mapping[relativeUri])) {
mapping[relativeUri] = [];

@@ -53,0 +53,0 @@ }

@@ -33,3 +33,3 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.logSnippets();

@@ -42,3 +42,3 @@ }

this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
const parsed = helpers_1.parseTestCaseAttempt({
const parsed = (0, helpers_1.parseTestCaseAttempt)({
cwd: this.cwd,

@@ -45,0 +45,0 @@ snippetBuilder: this.snippetBuilder,

@@ -35,4 +35,4 @@ "use strict";

getStepParameterNames(step) {
if (value_checker_1.doesHaveValue(step.argument)) {
const argumentName = step_arguments_1.parseStepArgument(step.argument, {
if ((0, value_checker_1.doesHaveValue)(step.argument)) {
const argumentName = (0, step_arguments_1.parseStepArgument)(step.argument, {
dataTable: () => 'dataTable',

@@ -39,0 +39,0 @@ docString: () => 'docString',

@@ -16,8 +16,8 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunStarted)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunStarted)) {
testRunStartedTimestamp = envelope.testRunStarted.timestamp;
}
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
const testRunFinishedTimestamp = envelope.testRunFinished.timestamp;
this.logSummary(time_1.durationBetweenTimestamps(testRunStartedTimestamp, testRunFinishedTimestamp));
this.logSummary((0, time_1.durationBetweenTimestamps)(testRunStartedTimestamp, testRunFinishedTimestamp));
}

@@ -31,6 +31,6 @@ });

testCaseAttempts.forEach((testCaseAttempt) => {
if (helpers_1.isFailure(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
if ((0, helpers_1.isFailure)(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
failures.push(testCaseAttempt);
}
else if (helpers_1.isWarning(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
else if ((0, helpers_1.isWarning)(testCaseAttempt.worstTestStepResult, testCaseAttempt.willBeRetried)) {
warnings.push(testCaseAttempt);

@@ -40,3 +40,3 @@ }

if (this.eventDataCollector.undefinedParameterTypes.length > 0) {
this.log(issue_helpers_1.formatUndefinedParameterTypes(this.eventDataCollector.undefinedParameterTypes));
this.log((0, issue_helpers_1.formatUndefinedParameterTypes)(this.eventDataCollector.undefinedParameterTypes));
}

@@ -49,3 +49,3 @@ if (failures.length > 0) {

}
this.log(helpers_1.formatSummary({
this.log((0, helpers_1.formatSummary)({
colorFns: this.colorFns,

@@ -59,3 +59,3 @@ testCaseAttempts,

issues.forEach((testCaseAttempt, index) => {
this.log(helpers_1.formatIssue({
this.log((0, helpers_1.formatIssue)({
colorFns: this.colorFns,

@@ -62,0 +62,0 @@ cwd: this.cwd,

@@ -34,3 +34,3 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.logUsage();

@@ -41,3 +41,3 @@ }

logUsage() {
const usage = helpers_1.getUsage({
const usage = (0, helpers_1.getUsage)({
cwd: this.cwd,

@@ -66,3 +66,3 @@ stepDefinitions: this.supportCodeLibrary.stepDefinitions,

if (matches.length > 0) {
if (value_checker_1.doesHaveValue(meanDuration)) {
if ((0, value_checker_1.doesHaveValue)(meanDuration)) {
col2.push(`${messages.TimeConversion.durationToMilliseconds(meanDuration).toFixed(2)}ms`);

@@ -77,6 +77,6 @@ }

}
const col3 = [helpers_1.formatLocation({ line, uri })];
const col3 = [(0, helpers_1.formatLocation)({ line, uri })];
matches.slice(0, 5).forEach((match) => {
col1.push(` ${match.text}`);
if (value_checker_1.doesHaveValue(match.duration)) {
if ((0, value_checker_1.doesHaveValue)(match.duration)) {
col2.push(`${messages.TimeConversion.durationToMilliseconds(match.duration).toFixed(2)}ms`);

@@ -87,3 +87,3 @@ }

}
col3.push(helpers_1.formatLocation(match));
col3.push((0, helpers_1.formatLocation)(match));
});

@@ -90,0 +90,0 @@ if (matches.length > 5) {

@@ -13,3 +13,3 @@ "use strict";

options.eventBroadcaster.on('envelope', (envelope) => {
if (value_checker_1.doesHaveValue(envelope.testRunFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
this.logUsage();

@@ -20,3 +20,3 @@ }

logUsage() {
const usage = helpers_1.getUsage({
const usage = (0, helpers_1.getUsage)({
cwd: this.cwd,

@@ -23,0 +23,0 @@ stepDefinitions: this.supportCodeLibrary.stepDefinitions,

@@ -9,2 +9,3 @@ import * as formatterHelpers from './formatter/helpers';

export { default as DataTable } from './models/data_table';
export { version } from './version';
export { default as Formatter, IFormatterOptions } from './formatter';

@@ -11,0 +12,0 @@ export { default as FormatterBuilder } from './formatter/builder';

@@ -25,3 +25,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.wrapPromiseWithTimeout = exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
exports.wrapPromiseWithTimeout = exports.Status = exports.World = exports.When = exports.Then = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineStep = exports.defineParameterType = exports.BeforeStep = exports.BeforeAll = exports.Before = exports.AfterStep = exports.AfterAll = exports.After = exports.formatterHelpers = exports.UsageJsonFormatter = exports.UsageFormatter = exports.SummaryFormatter = exports.SnippetsFormatter = exports.RerunFormatter = exports.ProgressFormatter = exports.JsonFormatter = exports.FormatterBuilder = exports.Formatter = exports.version = exports.DataTable = exports.supportCodeLibraryBuilder = exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = void 0;
const formatterHelpers = __importStar(require("./formatter/helpers"));

@@ -44,2 +44,4 @@ exports.formatterHelpers = formatterHelpers;

Object.defineProperty(exports, "DataTable", { enumerable: true, get: function () { return __importDefault(data_table_1).default; } });
var version_1 = require("./version");
Object.defineProperty(exports, "version", { enumerable: true, get: function () { return version_1.version; } });
// Formatters

@@ -46,0 +48,0 @@ var formatter_1 = require("./formatter");

@@ -18,4 +18,4 @@ "use strict";

const parameters = await Promise.all(this.expression.match(step.text).map((arg) => arg.getValue(world)));
if (value_checker_1.doesHaveValue(step.argument)) {
const argumentParamater = step_arguments_1.parseStepArgument(step.argument, {
if ((0, value_checker_1.doesHaveValue)(step.argument)) {
const argumentParamater = (0, step_arguments_1.parseStepArgument)(step.argument, {
dataTable: (arg) => new data_table_1.default(arg),

@@ -33,3 +33,3 @@ docString: (arg) => arg.content,

matchesStepName(stepName) {
return value_checker_1.doesHaveValue(this.expression.match(stepName));
return (0, value_checker_1.doesHaveValue)(this.expression.match(stepName));
}

@@ -36,0 +36,0 @@ }

@@ -35,7 +35,7 @@ "use strict";

const match = FEATURE_LINENUM_REGEXP.exec(featurePath);
if (value_checker_1.doesHaveValue(match)) {
if ((0, value_checker_1.doesHaveValue)(match)) {
const uri = path_1.default.normalize(match[1]);
const linesExpression = match[2];
if (value_checker_1.doesHaveValue(linesExpression)) {
if (value_checker_1.doesNotHaveValue(mapping[uri])) {
if ((0, value_checker_1.doesHaveValue)(linesExpression)) {
if ((0, value_checker_1.doesNotHaveValue)(mapping[uri])) {
mapping[uri] = [];

@@ -57,4 +57,4 @@ }

const linesToMatch = this.featureUriToLinesMapping[uri];
if (value_checker_1.doesHaveValue(linesToMatch)) {
const gherkinScenarioLocationMap = gherkin_document_parser_1.getGherkinScenarioLocationMap(gherkinDocument);
if ((0, value_checker_1.doesHaveValue)(linesToMatch)) {
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
const pickleLines = new Set(pickle.astNodeIds.map((sourceId) => gherkinScenarioLocationMap[sourceId].line));

@@ -82,8 +82,8 @@ const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x));

constructor(tagExpression) {
if (value_checker_1.doesHaveValue(tagExpression) && tagExpression !== '') {
this.tagExpressionNode = tag_expressions_1.default(tagExpression);
if ((0, value_checker_1.doesHaveValue)(tagExpression) && tagExpression !== '') {
this.tagExpressionNode = (0, tag_expressions_1.default)(tagExpression);
}
}
matchesAllTagExpressions(pickle) {
if (value_checker_1.doesNotHaveValue(this.tagExpressionNode)) {
if ((0, value_checker_1.doesNotHaveValue)(this.tagExpressionNode)) {
return true;

@@ -90,0 +90,0 @@ }

@@ -83,3 +83,3 @@ "use strict";

value: group.value,
children: value_checker_1.doesHaveValue(group.children)
children: (0, value_checker_1.doesHaveValue)(group.children)
? group.children.map((child) => mapArgumentGroup(child))

@@ -86,0 +86,0 @@ : undefined,

@@ -37,3 +37,3 @@ "use strict";

if (Buffer.isBuffer(data)) {
if (value_checker_1.doesNotHaveValue(mediaType)) {
if ((0, value_checker_1.doesNotHaveValue)(mediaType)) {
throw Error('Buffer attachments must specify a media type');

@@ -44,3 +44,3 @@ }

else if (is_stream_1.default.readable(data)) {
if (value_checker_1.doesNotHaveValue(mediaType)) {
if ((0, value_checker_1.doesNotHaveValue)(mediaType)) {
throw Error('Stream attachments must specify a media type');

@@ -51,3 +51,3 @@ }

else if (typeof data === 'string') {
if (value_checker_1.doesNotHaveValue(mediaType)) {
if ((0, value_checker_1.doesNotHaveValue)(mediaType)) {
mediaType = 'text/plain';

@@ -90,3 +90,3 @@ }

});
if (value_checker_1.doesHaveValue(callback)) {
if ((0, value_checker_1.doesHaveValue)(callback)) {
promise.then(callback, callback);

@@ -93,0 +93,0 @@ }

@@ -58,8 +58,11 @@ "use strict";

const pattern = stepDefinition.pattern.toString();
return [pattern, location_helpers_1.formatLocation(stepDefinition)];
return [pattern, (0, location_helpers_1.formatLocation)(stepDefinition)];
}));
return `${'Multiple step definitions match:' + '\n'}${indent_string_1.default(table.toString(), 2)}`;
return `${'Multiple step definitions match:' + '\n'}${(0, indent_string_1.default)(table.toString(), 2)}`;
}
exports.getAmbiguousStepException = getAmbiguousStepException;
function retriesForPickle(pickle, options) {
if (!options.retry) {
return 0;
}
const retries = options.retry;

@@ -70,3 +73,3 @@ if (retries === 0) {

const retryTagFilter = options.retryTagFilter;
if (retryTagFilter === '') {
if (!retryTagFilter) {
return retries;

@@ -73,0 +76,0 @@ }

@@ -8,2 +8,5 @@ /// <reference types="node" />

import TestRunHookDefinition from '../models/test_run_hook_definition';
export interface IRuntime {
start: () => Promise<boolean>;
}
export interface INewRuntimeOptions {

@@ -26,3 +29,4 @@ eventBroadcaster: EventEmitter;

}
export default class Runtime {
export declare const DEFAULT_RUNTIME_OPTIONS: IRuntimeOptions;
export default class Runtime implements IRuntime {
private readonly eventBroadcaster;

@@ -29,0 +33,0 @@ private readonly eventDataCollector;

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_RUNTIME_OPTIONS = void 0;
const helpers_1 = require("../formatter/helpers");

@@ -16,2 +17,11 @@ const stack_trace_filter_1 = __importDefault(require("../stack_trace_filter"));

const assemble_test_cases_1 = require("./assemble_test_cases");
exports.DEFAULT_RUNTIME_OPTIONS = {
dryRun: false,
failFast: false,
filterStacktraces: true,
retry: 0,
retryTagFilter: '',
strict: true,
worldParameters: {},
};
class Runtime {

@@ -38,6 +48,6 @@ constructor({ eventBroadcaster, eventDataCollector, newId, options, pickleIds, supportCodeLibrary, }) {

thisArg: null,
timeoutInMilliseconds: value_checker_1.valueOrDefault(hookDefinition.options.timeout, this.supportCodeLibrary.defaultTimeout),
timeoutInMilliseconds: (0, value_checker_1.valueOrDefault)(hookDefinition.options.timeout, this.supportCodeLibrary.defaultTimeout),
});
if (value_checker_1.doesHaveValue(error)) {
const location = helpers_1.formatLocation(hookDefinition);
if ((0, value_checker_1.doesHaveValue)(error)) {
const location = (0, helpers_1.formatLocation)(hookDefinition);
throw new verror_1.default(error, `${name} hook errored, process exiting: ${location}`);

@@ -49,3 +59,3 @@ }

const pickle = this.eventDataCollector.getPickle(pickleId);
const retries = helpers_2.retriesForPickle(pickle, this.options);
const retries = (0, helpers_2.retriesForPickle)(pickle, this.options);
const skip = this.options.dryRun || (this.options.failFast && !this.success);

@@ -65,3 +75,3 @@ const testCaseRunner = new test_case_runner_1.default({

const status = await testCaseRunner.run();
if (helpers_2.shouldCauseFailure(status, this.options)) {
if ((0, helpers_2.shouldCauseFailure)(status, this.options)) {
this.success = false;

@@ -82,3 +92,3 @@ }

await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
const assembledTestCases = await assemble_test_cases_1.assembleTestCases({
const assembledTestCases = await (0, assemble_test_cases_1.assembleTestCases)({
eventBroadcaster: this.eventBroadcaster,

@@ -85,0 +95,0 @@ newId: this.newId,

@@ -6,3 +6,3 @@ /// <reference types="node" />

import { EventDataCollector } from '../../formatter/helpers';
import { IRuntimeOptions } from '..';
import { IRuntime, IRuntimeOptions } from '..';
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';

@@ -21,2 +21,3 @@ import { ICoordinatorReport } from './command_types';

supportCodeRequiredModules: string[];
numberOfWorkers: number;
}

@@ -27,3 +28,3 @@ interface IWorker {

}
export default class Coordinator {
export default class Coordinator implements IRuntime {
private readonly cwd;

@@ -43,4 +44,5 @@ private readonly eventBroadcaster;

private readonly supportCodeRequiredModules;
private readonly numberOfWorkers;
private success;
constructor({ cwd, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, supportCodePaths, supportCodeRequiredModules, }: INewCoordinatorOptions);
constructor({ cwd, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, supportCodePaths, supportCodeRequiredModules, numberOfWorkers, }: INewCoordinatorOptions);
parseWorkerMessage(worker: IWorker, message: ICoordinatorReport): void;

@@ -50,5 +52,5 @@ startWorker(id: string, total: number): void;

parseTestCaseResult(testCaseFinished: messages.TestCaseFinished): void;
run(numberOfWorkers: number): Promise<boolean>;
start(): Promise<boolean>;
giveWork(worker: IWorker): void;
}
export {};

@@ -34,3 +34,3 @@ "use strict";

class Coordinator {
constructor({ cwd, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, supportCodePaths, supportCodeRequiredModules, }) {
constructor({ cwd, eventBroadcaster, eventDataCollector, pickleIds, options, newId, supportCodeLibrary, supportCodePaths, supportCodeRequiredModules, numberOfWorkers, }) {
this.cwd = cwd;

@@ -46,2 +46,3 @@ this.eventBroadcaster = eventBroadcaster;

this.pickleIds = pickleIds;
this.numberOfWorkers = numberOfWorkers;
this.nextPickleIdIndex = 0;

@@ -55,6 +56,6 @@ this.success = true;

}
else if (value_checker_1.doesHaveValue(message.jsonEnvelope)) {
else if ((0, value_checker_1.doesHaveValue)(message.jsonEnvelope)) {
const envelope = messages.parseEnvelope(message.jsonEnvelope);
this.eventBroadcaster.emit('envelope', envelope);
if (value_checker_1.doesHaveValue(envelope.testCaseFinished)) {
if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
this.parseTestCaseResult(envelope.testCaseFinished);

@@ -68,3 +69,3 @@ }

startWorker(id, total) {
const workerProcess = child_process_1.fork(runWorkerPath, [], {
const workerProcess = (0, child_process_1.fork)(runWorkerPath, [], {
cwd: this.cwd,

@@ -122,7 +123,7 @@ env: {

if (!testCaseFinished.willBeRetried &&
helpers_1.shouldCauseFailure(worstTestStepResult.status, this.options)) {
(0, helpers_1.shouldCauseFailure)(worstTestStepResult.status, this.options)) {
this.success = false;
}
}
async run(numberOfWorkers) {
async start() {
const envelope = {

@@ -135,3 +136,3 @@ testRunStarted: {

this.stopwatch.start();
this.assembledTestCases = await assemble_test_cases_1.assembleTestCases({
this.assembledTestCases = await (0, assemble_test_cases_1.assembleTestCases)({
eventBroadcaster: this.eventBroadcaster,

@@ -143,4 +144,4 @@ newId: this.newId,

return await new Promise((resolve) => {
for (let i = 0; i <= numberOfWorkers; i++) {
this.startWorker(i.toString(), numberOfWorkers);
for (let i = 0; i <= this.numberOfWorkers; i++) {
this.startWorker(i.toString(), this.numberOfWorkers);
}

@@ -161,3 +162,3 @@ this.onFinish = resolve;

const gherkinDocument = this.eventDataCollector.getGherkinDocument(pickle.uri);
const retries = helpers_1.retriesForPickle(pickle, this.options);
const retries = (0, helpers_1.retriesForPickle)(pickle, this.options);
const skip = this.options.dryRun || (this.options.failFast && !this.success);

@@ -164,0 +165,0 @@ const runCommand = {

@@ -11,3 +11,3 @@ "use strict";

const exit = (exitCode, error, message) => {
if (value_checker_1.doesHaveValue(error)) {
if ((0, value_checker_1.doesHaveValue)(error)) {
console.error(verror_1.default.fullStack(new verror_1.default(error, message))); // eslint-disable-line no-console

@@ -14,0 +14,0 @@ }

@@ -40,7 +40,7 @@ "use strict";

for (const codePath of supportCodePaths) {
if (supportCodeRequiredModules.length || !helpers_2.isJavaScript(codePath)) {
if (supportCodeRequiredModules.length || !(0, helpers_2.isJavaScript)(codePath)) {
require(codePath);
}
else {
await importer(url_1.pathToFileURL(codePath));
await importer((0, url_1.pathToFileURL)(codePath));
}

@@ -66,3 +66,3 @@ }

async receiveMessage(message) {
if (value_checker_1.doesHaveValue(message.initialize)) {
if ((0, value_checker_1.doesHaveValue)(message.initialize)) {
await this.initialize(message.initialize);

@@ -73,3 +73,3 @@ }

}
else if (value_checker_1.doesHaveValue(message.run)) {
else if ((0, value_checker_1.doesHaveValue)(message.run)) {
await this.runTestCase(message.run);

@@ -80,3 +80,3 @@ }

const stopwatch = new stopwatch_1.RealTestRunStopwatch();
stopwatch.from(durations_1.duration(elapsed));
stopwatch.from((0, durations_1.duration)(elapsed));
const testCaseRunner = new test_case_runner_1.default({

@@ -106,6 +106,6 @@ eventBroadcaster: this.eventBroadcaster,

thisArg: null,
timeoutInMilliseconds: value_checker_1.valueOrDefault(hookDefinition.options.timeout, this.supportCodeLibrary.defaultTimeout),
timeoutInMilliseconds: (0, value_checker_1.valueOrDefault)(hookDefinition.options.timeout, this.supportCodeLibrary.defaultTimeout),
});
if (value_checker_1.doesHaveValue(error)) {
const location = helpers_1.formatLocation(hookDefinition);
if ((0, value_checker_1.doesHaveValue)(error)) {
const location = (0, helpers_1.formatLocation)(hookDefinition);
this.exit(1, error, `${name} hook errored on worker ${this.id}, process exiting: ${location}`);

@@ -112,0 +112,0 @@ }

@@ -45,4 +45,4 @@ "use strict";

}
if (value_checker_1.doesNotHaveValue(error)) {
const timeoutInMilliseconds = value_checker_1.valueOrDefault(stepDefinition.options.timeout, defaultTimeout);
if ((0, value_checker_1.doesNotHaveValue)(error)) {
const timeoutInMilliseconds = (0, value_checker_1.valueOrDefault)(stepDefinition.options.timeout, defaultTimeout);
if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {

@@ -71,4 +71,4 @@ const data = await user_code_runner_1.default.run({

}
else if (value_checker_1.doesHaveValue(error)) {
message = assertion_error_formatter_1.format(error);
else if ((0, value_checker_1.doesHaveValue)(error)) {
message = (0, assertion_error_formatter_1.format)(error);
status = messages.TestStepResultStatus.FAILED;

@@ -75,0 +75,0 @@ }

@@ -27,3 +27,3 @@ "use strict";

constructor() {
this.stopwatch = durations_1.stopwatch();
this.stopwatch = (0, durations_1.stopwatch)();
this.base = null;

@@ -46,3 +46,3 @@ }

if (this.base !== null) {
return durations_1.duration(this.base.nanos() + current.nanos());
return (0, durations_1.duration)(this.base.nanos() + current.nanos());
}

@@ -72,5 +72,5 @@ return current;

duration() {
const current = durations_1.duration(this.count * 1000000);
const current = (0, durations_1.duration)(this.count * 1000000);
if (this.base !== null) {
return durations_1.duration(this.base.nanos() + current.nanos());
return (0, durations_1.duration)(this.base.nanos() + current.nanos());
}

@@ -77,0 +77,0 @@ return current;

@@ -34,3 +34,3 @@ "use strict";

this.attachmentManager = new attachment_manager_1.default(({ data, media }) => {
if (value_checker_1.doesNotHaveValue(this.currentTestStepId)) {
if ((0, value_checker_1.doesNotHaveValue)(this.currentTestStepId)) {
throw new Error('Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.');

@@ -87,3 +87,3 @@ }

}
return messages_1.getWorstTestStepResult(this.testStepResults);
return (0, messages_1.getWorstTestStepResult)(this.testStepResults);
}

@@ -144,3 +144,3 @@ async invokeStep(step, stepDefinition, hookParameter) {

await this.aroundTestStep(testStep.id, async () => {
if (value_checker_1.doesHaveValue(testStep.hookId)) {
if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
const hookParameter = {

@@ -217,3 +217,3 @@ gherkinDocument: this.gherkinDocument,

return {
message: helpers_1.getAmbiguousStepException(stepDefinitions),
message: (0, helpers_1.getAmbiguousStepException)(stepDefinitions),
status: messages.TestStepResultStatus.AMBIGUOUS,

@@ -231,3 +231,3 @@ duration: messages.TimeConversion.millisecondsToDuration(0),

let stepResults = await this.runStepHooks(this.getBeforeStepHookDefinitions(), pickleStep);
if (messages_1.getWorstTestStepResult(stepResults).status !==
if ((0, messages_1.getWorstTestStepResult)(stepResults).status !==
messages.TestStepResultStatus.FAILED) {

@@ -239,3 +239,3 @@ stepResult = await this.invokeStep(pickleStep, stepDefinitions[0]);

stepResults = stepResults.concat(afterStepHookResults);
const finalStepResult = messages_1.getWorstTestStepResult(stepResults);
const finalStepResult = (0, messages_1.getWorstTestStepResult)(stepResults);
let finalDuration = messages.TimeConversion.millisecondsToDuration(0);

@@ -242,0 +242,0 @@ for (const result of stepResults) {

@@ -34,7 +34,7 @@ "use strict";

isFrameInCucumber(frame) {
const fileName = value_checker_1.valueOrDefault(frame.getFileName(), '');
const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
return isFileNameInCucumber(fileName);
}
isFrameInNode(frame) {
const fileName = value_checker_1.valueOrDefault(frame.getFileName(), '');
const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
return !fileName.includes(path_1.default.sep);

@@ -41,0 +41,0 @@ }

@@ -10,6 +10,6 @@ "use strict";

function parseStepArgument(arg, mapping) {
if (value_checker_1.doesHaveValue(arg.dataTable)) {
if ((0, value_checker_1.doesHaveValue)(arg.dataTable)) {
return mapping.dataTable(arg.dataTable);
}
else if (value_checker_1.doesHaveValue(arg.docString)) {
else if ((0, value_checker_1.doesHaveValue)(arg.docString)) {
return mapping.docString(arg.docString);

@@ -16,0 +16,0 @@ }

@@ -7,3 +7,4 @@ "use strict";

exports.SupportCodeLibraryBuilder = exports.builtinParameterTypes = void 0;
const build_helpers_1 = require("./build_helpers");
const build_parameter_type_1 = require("./build_parameter_type");
const get_definition_line_and_uri_1 = require("./get_definition_line_and_uri");
const test_case_hook_definition_1 = __importDefault(require("../models/test_case_hook_definition"));

@@ -47,3 +48,3 @@ const test_step_hook_definition_1 = __importDefault(require("../models/test_step_hook_definition"));

defineParameterType(options) {
const parameterType = build_helpers_1.buildParameterType(options);
const parameterType = (0, build_parameter_type_1.buildParameterType)(options);
this.parameterTypeRegistry.defineParameterType(parameterType);

@@ -56,7 +57,7 @@ }

}
const { line, uri } = build_helpers_1.getDefinitionLineAndUri(this.cwd);
validate_arguments_1.default({
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
(0, validate_arguments_1.default)({
args: { code, pattern, options },
fnName: 'defineStep',
location: helpers_1.formatLocation({ line, uri }),
location: (0, helpers_1.formatLocation)({ line, uri }),
});

@@ -80,7 +81,7 @@ this.stepDefinitionConfigs.push({

}
const { line, uri } = build_helpers_1.getDefinitionLineAndUri(this.cwd);
validate_arguments_1.default({
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
(0, validate_arguments_1.default)({
args: { code, options },
fnName: 'defineTestCaseHook',
location: helpers_1.formatLocation({ line, uri }),
location: (0, helpers_1.formatLocation)({ line, uri }),
});

@@ -104,7 +105,7 @@ getCollection().push({

}
const { line, uri } = build_helpers_1.getDefinitionLineAndUri(this.cwd);
validate_arguments_1.default({
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
(0, validate_arguments_1.default)({
args: { code, options },
fnName: 'defineTestStepHook',
location: helpers_1.formatLocation({ line, uri }),
location: (0, helpers_1.formatLocation)({ line, uri }),
});

@@ -125,7 +126,7 @@ getCollection().push({

}
const { line, uri } = build_helpers_1.getDefinitionLineAndUri(this.cwd);
validate_arguments_1.default({
const { line, uri } = (0, get_definition_line_and_uri_1.getDefinitionLineAndUri)(this.cwd);
(0, validate_arguments_1.default)({
args: { code, options },
fnName: 'defineTestRunHook',
location: helpers_1.formatLocation({ line, uri }),
location: (0, helpers_1.formatLocation)({ line, uri }),
});

@@ -141,7 +142,7 @@ getCollection().push({

wrapCode({ code, wrapperOptions, }) {
if (value_checker_1.doesHaveValue(this.definitionFunctionWrapper)) {
if ((0, value_checker_1.doesHaveValue)(this.definitionFunctionWrapper)) {
const codeLength = code.length;
const wrappedCode = this.definitionFunctionWrapper(code, wrapperOptions);
if (wrappedCode !== code) {
return util_arity_1.default(codeLength, wrappedCode);
return (0, util_arity_1.default)(codeLength, wrappedCode);
}

@@ -210,3 +211,3 @@ return wrappedCode;

catch (e) {
if (value_checker_1.doesHaveValue(e.undefinedParameterTypeName)) {
if ((0, value_checker_1.doesHaveValue)(e.undefinedParameterTypeName)) {
undefinedParameterTypes.push({

@@ -213,0 +214,0 @@ name: e.undefinedParameterTypeName,

@@ -14,3 +14,3 @@ "use strict";

argsArray.push((error, result) => {
if (value_checker_1.doesHaveValue(error)) {
if ((0, value_checker_1.doesHaveValue)(error)) {
reject(error);

@@ -33,3 +33,3 @@ }

const callbackInterface = fn.length === argsArray.length;
const promiseInterface = value_checker_1.doesHaveValue(fnReturn) && typeof fnReturn.then === 'function';
const promiseInterface = (0, value_checker_1.doesHaveValue)(fnReturn) && typeof fnReturn.then === 'function';
if (callbackInterface && promiseInterface) {

@@ -62,3 +62,3 @@ return {

` within ${timeoutInMilliseconds.toString()} milliseconds`;
finalPromise = time_1.wrapPromiseWithTimeout(finalPromise, timeoutInMilliseconds, timeoutMessage);
finalPromise = (0, time_1.wrapPromiseWithTimeout)(finalPromise, timeoutInMilliseconds, timeoutMessage);
}

@@ -73,3 +73,3 @@ let error, result;

}
else if (value_checker_1.doesHaveValue(e)) {
else if ((0, value_checker_1.doesHaveValue)(e)) {
error = util_1.default.format(e);

@@ -76,0 +76,0 @@ }

@@ -11,3 +11,3 @@ {

],
"version": "8.0.0-rc.1",
"version": "8.0.0-rc.2",
"homepage": "https://github.com/cucumber/cucumber-js",

@@ -103,2 +103,3 @@ "author": "Julien Biezemans <jb@jbpros.com>",

"M.P. Korstanje <mpkorstanje@users.noreply.github.com>",
"mannyluvstacos <mannyis@typingona.computer>",
"Marat Dyatko <vectart@gmail.com>",

@@ -180,3 +181,4 @@ "Marc Burton <marc.burton@first-utility.com>",

"require": "./lib/*.js"
}
},
"./package.json": "./package.json"
},

@@ -188,13 +190,14 @@ "types": "./lib/index.d.ts",

"dependencies": {
"@cucumber/create-meta": "6.0.1",
"@cucumber/cucumber-expressions": "^14.0.0",
"@cucumber/gherkin": "^22.0.0",
"@cucumber/gherkin-streams": "^4.0.0",
"@cucumber/html-formatter": "^17.0.0",
"@cucumber/messages": "^17.1.1",
"@cucumber/tag-expressions": "^4.1.0",
"@cspotcode/source-map-support": "^0.7.0",
"@cucumber/ci-environment": "8.0.1",
"@cucumber/cucumber-expressions": "14.0.0",
"@cucumber/gherkin": "22.0.0",
"@cucumber/gherkin-streams": "4.0.0",
"@cucumber/html-formatter": "17.0.0",
"@cucumber/messages": "17.1.1",
"@cucumber/tag-expressions": "4.1.0",
"assertion-error-formatter": "^3.0.0",
"capital-case": "^1.0.4",
"cli-table3": "^0.6.0",
"colors": "^1.4.0",
"cli-table3": "0.6.1",
"colors": "1.4.0",
"commander": "^8.0.0",

@@ -213,3 +216,2 @@ "duration": "^0.2.2",

"stack-chain": "^2.0.0",
"stacktrace-js": "^2.0.2",
"string-argv": "^0.3.1",

@@ -221,59 +223,58 @@ "tmp": "^0.2.1",

"devDependencies": {
"@cucumber/compatibility-kit": "^9.0.0",
"@cucumber/message-streams": "^3.0.0",
"@cucumber/query": "^11.0.0",
"@sinonjs/fake-timers": "8.0.1",
"@types/chai": "4.2.22",
"@cucumber/compatibility-kit": "9.1.2",
"@cucumber/message-streams": "3.0.0",
"@cucumber/query": "11.0.0",
"@sinonjs/fake-timers": "8.1.0",
"@types/chai": "4.3.0",
"@types/dirty-chai": "2.0.2",
"@types/express": "4.17.13",
"@types/fs-extra": "9.0.13",
"@types/glob": "7.1.4",
"@types/glob": "7.2.0",
"@types/mocha": "9.0.0",
"@types/mustache": "4.1.2",
"@types/mz": "2.7.4",
"@types/node": "14.17.20",
"@types/node": "16.11.17",
"@types/progress": "2.0.5",
"@types/resolve": "1.20.1",
"@types/semver": "7.3.8",
"@types/sinon-chai": "3.2.5",
"@types/sinonjs__fake-timers": "6.0.4",
"@types/semver": "7.3.9",
"@types/sinon-chai": "3.2.8",
"@types/sinonjs__fake-timers": "8.1.1",
"@types/stream-buffers": "3.0.4",
"@types/tmp": "0.2.1",
"@types/tmp": "0.2.3",
"@types/verror": "1.10.5",
"@typescript-eslint/eslint-plugin": "4.32.0",
"@typescript-eslint/parser": "4.32.0",
"@typescript-eslint/eslint-plugin": "5.6.0",
"@typescript-eslint/parser": "5.6.0",
"chai": "4.3.4",
"chai-exclude": "2.1.0",
"coffeescript": "2.6.0",
"coffeescript": "2.6.1",
"dependency-lint": "7.1.0",
"dirty-chai": "2.0.1",
"eslint": "7.32.0",
"eslint": "8.4.1",
"eslint-config-prettier": "8.3.0",
"eslint-config-standard-with-typescript": "21.0.1",
"eslint-plugin-import": "2.24.2",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-prettier": "4.0.0",
"eslint-plugin-promise": "5.1.0",
"eslint-plugin-standard": "4.1.0",
"express": "4.17.1",
"express": "4.17.2",
"fs-extra": "10.0.0",
"mocha": "^9.1.3",
"genversion": "3.0.2",
"mocha": "9.1.3",
"mustache": "4.2.0",
"nyc": "15.1.0",
"prettier": "2.4.1",
"prettier": "2.5.1",
"reindent-template-literals": "1.1.0",
"semver": "7.3.5",
"sinon": "11.1.2",
"shx": "0.3.3",
"sinon": "12.0.1",
"sinon-chai": "3.7.0",
"stream-buffers": "3.0.2",
"stream-to-string": "1.2.0",
"ts-node": "^10.3.0",
"tsd": "0.17.0",
"typescript": "^4.4.4"
"ts-node": "10.4.0",
"tsd": "0.19.1",
"typescript": "4.5.4"
},
"scripts": {
"build-local": "tsc --build tsconfig.node.json && cp src/importer.js lib/ && cp src/wrapper.mjs lib/",
"build-local": "genversion --es6 src/version.ts && tsc --build tsconfig.node.json && shx cp src/importer.js lib/ && shx cp src/wrapper.mjs lib/",
"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"feature-test": "node ./bin/cucumber-js",
"html-formatter": "node ./bin/cucumber-js --profile htmlFormatter",
"lint-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",

@@ -280,0 +281,0 @@ "lint-code": "eslint \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc