Socket
Socket
Sign inDemoInstall

@cucumber/cucumber

Package Overview
Dependencies
Maintainers
2
Versions
59
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 10.1.0 to 10.2.1

lib/publish/types.d.ts

7

lib/api/environment.d.ts

@@ -0,2 +1,7 @@

import { ILogger } from '../logger';
import { IRunEnvironment } from './types';
export declare function mergeEnvironment(provided: IRunEnvironment): Required<IRunEnvironment>;
type EnvironmentWithLogger = Required<IRunEnvironment> & {
logger: ILogger;
};
export declare function mergeEnvironment(provided: IRunEnvironment): EnvironmentWithLogger;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeEnvironment = void 0;
const console_logger_1 = require("./console_logger");
function mergeEnvironment(provided) {
return Object.assign({}, {
const fullEnvironment = Object.assign({}, {
cwd: process.cwd(),

@@ -12,4 +13,8 @@ stdout: process.stdout,

}, provided);
return {
...fullEnvironment,
logger: new console_logger_1.ConsoleLogger(fullEnvironment.stderr, fullEnvironment.debug),
};
}
exports.mergeEnvironment = mergeEnvironment;
//# sourceMappingURL=environment.js.map

4

lib/api/formatters.d.ts

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

import { EventDataCollector } from '../formatter/helpers';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { ILogger } from '../logger';

@@ -20,3 +20,3 @@ import { IRunOptionsFormats } from './types';

configuration: IRunOptionsFormats;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}): Promise<() => Promise<void>>;
/**
* Cucumber for JavaScript
* JavaScript API for running and extending Cucumber
*
* @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
* @packageDocumentation
* @module api
* @remarks
* These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
*/
export { IConfiguration } from '../configuration';
export { IPickleOrder } from '../filter';
export { IPublishConfig } from '../publish';
export * from './load_configuration';

@@ -9,0 +13,0 @@ export * from './load_sources';

"use strict";
/**
* Cucumber for JavaScript
* JavaScript API for running and extending Cucumber
*
* @remarks These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
* @packageDocumentation
* @module api
* @remarks
* These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
*/

@@ -8,0 +10,0 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

import { IRunEnvironment, IResolvedConfiguration, ILoadConfigurationOptions } from './types';
/**
* Load user-authored configuration to be used in a test run.
* Load user-authored configuration to be used in a test run
*
* @public
* @param options - Coordinates required to find configuration.
* @param environment - Project environment.
* @param options - Coordinates required to find configuration
* @param environment - Project environment
*/
export declare function loadConfiguration(options?: ILoadConfigurationOptions, environment?: IRunEnvironment): Promise<IResolvedConfiguration>;

@@ -9,13 +9,11 @@ "use strict";

const environment_1 = require("./environment");
const console_logger_1 = require("./console_logger");
/**
* Load user-authored configuration to be used in a test run.
* Load user-authored configuration to be used in a test run
*
* @public
* @param options - Coordinates required to find configuration.
* @param environment - Project environment.
* @param options - Coordinates required to find configuration
* @param environment - Project environment
*/
async function loadConfiguration(options = {}, environment = {}) {
const { cwd, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
const { cwd, env, logger } = (0, environment_1.mergeEnvironment)(environment);
const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);

@@ -25,2 +23,5 @@ if (configFile) {

}
else if (configFile === false) {
logger.debug('Skipping configuration file resolution');
}
else {

@@ -27,0 +28,0 @@ logger.debug('No configuration file found');

import { ILoadSourcesResult, IRunEnvironment, ISourcesCoordinates } from './types';
/**
* Load and parse features, produce a filtered and ordered test plan and/or parse errors.
* Load and parse features, produce a filtered and ordered test plan and/or
* parse errors
*
* @public
* @param coordinates - Coordinates required to find features
* @param environment - Project environment.
* @param coordinates - Coordinates required to find and process features
* @param environment - Project environment
*/
export declare function loadSources(coordinates: ISourcesCoordinates, environment?: IRunEnvironment): Promise<ILoadSourcesResult>;

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

const gherkin_1 = require("./gherkin");
const console_logger_1 = require("./console_logger");
const plugins_1 = require("./plugins");
/**
* Load and parse features, produce a filtered and ordered test plan and/or parse errors.
* Load and parse features, produce a filtered and ordered test plan and/or
* parse errors
*
* @public
* @param coordinates - Coordinates required to find features
* @param environment - Project environment.
* @param coordinates - Coordinates required to find and process features
* @param environment - Project environment
*/
async function loadSources(coordinates, environment = {}) {
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
const { cwd, stderr, debug } = mergedEnvironment;
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
const { cwd, logger } = mergedEnvironment;
const newId = messages_1.IdGenerator.uuid();

@@ -23,0 +22,0 @@ const pluginManager = await (0, plugins_1.initializeForLoadSources)(logger, coordinates, mergedEnvironment);

@@ -1,10 +0,9 @@

import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { ILoadSupportOptions, IRunEnvironment } from './types';
import { ILoadSupportOptions, IRunEnvironment, ISupportCodeLibrary } from './types';
/**
* Load support code for use in test runs.
* Load support code for use in test runs
*
* @public
* @param options - Subset of `IRunnableConfiguration` required to find the support code.
* @param environment - Project environment.
* @param options - Options required to find the support code
* @param environment - Project environment
*/
export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;

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

const environment_1 = require("./environment");
const console_logger_1 = require("./console_logger");
const plugins_1 = require("./plugins");
/**
* Load support code for use in test runs.
* Load support code for use in test runs
*
* @public
* @param options - Subset of `IRunnableConfiguration` required to find the support code.
* @param environment - Project environment.
* @param options - Options required to find the support code
* @param environment - Project environment
*/
async function loadSupport(options, environment = {}) {
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
const { cwd, stderr, debug } = mergedEnvironment;
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
const { cwd, logger } = mergedEnvironment;
const newId = messages_1.IdGenerator.uuid();

@@ -23,0 +21,0 @@ const pluginManager = await (0, plugins_1.initializeForLoadSupport)();

import { Envelope } from '@cucumber/messages';
import { IRunOptions, IRunEnvironment, IRunResult } from './types';
/**
* Execute a Cucumber test run.
* Execute a Cucumber test run and return the overall result
*
* @public
* @param configuration - Configuration loaded from `loadConfiguration`.
* @param environment - Project environment.
* @param onMessage - Callback fired each time Cucumber emits a message.
* @param options - Options for the run, obtainable via {@link loadConfiguration}
* @param environment - Project environment
* @param onMessage - Callback fired each time Cucumber emits a message
*/
export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
export declare function runCucumber(options: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;

@@ -15,28 +15,26 @@ "use strict";

const plugins_1 = require("./plugins");
const console_logger_1 = require("./console_logger");
/**
* Execute a Cucumber test run.
* Execute a Cucumber test run and return the overall result
*
* @public
* @param configuration - Configuration loaded from `loadConfiguration`.
* @param environment - Project environment.
* @param onMessage - Callback fired each time Cucumber emits a message.
* @param options - Options for the run, obtainable via {@link loadConfiguration}
* @param environment - Project environment
* @param onMessage - Callback fired each time Cucumber emits a message
*/
async function runCucumber(configuration, environment = {}, onMessage) {
async function runCucumber(options, environment = {}, onMessage) {
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
const { cwd, stdout, stderr, env, debug } = mergedEnvironment;
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
const { cwd, stdout, stderr, env, logger } = mergedEnvironment;
const newId = messages_1.IdGenerator.uuid();
const supportCoordinates = 'World' in configuration.support
? configuration.support.originalCoordinates
: configuration.support;
const supportCoordinates = 'originalCoordinates' in options.support
? options.support.originalCoordinates
: options.support;
const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {
...configuration,
...options,
support: supportCoordinates,
}, mergedEnvironment);
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, configuration.sources, supportCoordinates);
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
pluginManager.emit('paths:resolve', resolvedPaths);
const { sourcePaths, requirePaths, importPaths } = resolvedPaths;
const supportCodeLibrary = 'World' in configuration.support
? configuration.support
const supportCodeLibrary = 'originalCoordinates' in options.support
? options.support
: await (0, support_1.getSupportCodeLibrary)({

@@ -65,3 +63,3 @@ cwd,

eventDataCollector,
configuration: configuration.formats,
configuration: options.formats,
supportCodeLibrary,

@@ -77,3 +75,3 @@ });

sourcePaths,
coordinates: configuration.sources,
coordinates: options.sources,
onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),

@@ -113,3 +111,3 @@ });

importPaths,
options: configuration.runtime,
options: options.runtime,
});

@@ -116,0 +114,0 @@ const success = await runtime.start();

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

import { EventDataCollector } from '../formatter/helpers';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { ILogger } from '../logger';

@@ -17,3 +17,3 @@ import { IRunOptionsRuntime } from './types';

pickleIds: string[];
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
requireModules: string[];

@@ -20,0 +20,0 @@ requirePaths: string[];

import { IdGenerator } from '@cucumber/messages';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
export declare function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }: {

@@ -9,2 +9,2 @@ cwd: string;

importPaths: string[];
}): Promise<ISupportCodeLibrary>;
}): Promise<SupportCodeLibrary>;
/// <reference types="node" />
/// <reference types="node" />
import { Writable } from 'node:stream';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { FormatOptions, IPublishConfig } from '../formatter';
import { PickleOrder } from '../models/pickle_order';
import { IRuntimeOptions } from '../runtime';
import { JsonObject } from 'type-fest';
import { IPublishConfig } from '../publish';
import { IConfiguration } from '../configuration';
import { IPickleOrder } from '../filter';
/**
* Options for {@link loadConfiguration}
* @public

@@ -14,11 +14,15 @@ */

/**
* Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).
* Path to load configuration file from, or `false` to skip
* @default `cucumber.(json|yaml|yml|js|cjs|mjs)`
*/
file?: string;
file?: string | false;
/**
* Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).
* Zero or more profile names from which to source configuration in the file
* @remarks
* If omitted or empty, the `default` profile will be used.
*/
profiles?: string[];
/**
* Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.
* Ad-hoc configuration options to be merged over the top of whatever is
* loaded from the configuration file/profiles
*/

@@ -28,2 +32,3 @@ provided?: Partial<IConfiguration>;

/**
* Response from {@link loadConfiguration}
* @public

@@ -33,7 +38,8 @@ */

/**
* The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
* The final flat configuration object resolved from the configuration
* file/profiles plus any extra provided
*/
useConfiguration: IConfiguration;
/**
* The format that can be passed into `runCucumber`.
* The format that can be passed into {@link runCucumber}
*/

@@ -43,15 +49,38 @@ runConfiguration: IRunConfiguration;

/**
* Options relating to sources (i.e. feature files) - where to load them from,
* how to interpret, filter and order them
* @public
*/
export interface ISourcesCoordinates {
/**
* Default Gherkin dialect
* @remarks
* Used if no dialect is specified in the feature file itself.
*/
defaultDialect: string;
/**
* Paths and/or glob expressions to feature files
*/
paths: string[];
/**
* Regular expressions of which scenario names should match one of to be run
*/
names: string[];
/**
* Tag expression to filter which scenarios should be run
*/
tagExpression: string;
order: PickleOrder;
/**
* Run in the order defined, or in a random order
*/
order: IPickleOrder;
}
/**
* A pickle that has been successfully compiled from a source
* @public
*/
export interface IPlannedPickle {
/**
* Name of the pickle (after parameter resolution)
*/
name: string;

@@ -65,2 +94,3 @@ uri: string;

/**
* An error encountered when parsing a source
* @public

@@ -74,23 +104,53 @@ */

};
/**
* Error message explaining what went wrong with the parse
*/
message: string;
}
/**
* Response from {@link loadSources}
* @public
*/
export interface ILoadSourcesResult {
/**
* Pickles that have been successfully compiled, in the order they would be
* run in
*/
plan: IPlannedPickle[];
/**
* Any errors encountered when parsing sources
*/
errors: ISourcesError[];
}
/**
* Options relating to user code (aka support code) - where to load it from and
* how to preprocess it
* @public
*/
export interface ISupportCodeCoordinates {
/**
* Names of transpilation modules to load, via `require()`
*/
requireModules: string[];
/**
* Paths and/or glob expressions of user code to load, via `require()`
*/
requirePaths: string[];
/**
* Paths and/or glob expressions of user code to load, via `import()`
*/
importPaths: string[];
}
/**
* Options for {@link loadSupport}
* @public
* @remarks
* A subset of {@link IRunConfiguration}
*/
export interface ILoadSupportOptions {
/**
* @remarks
* This is needed because the default support path locations are derived from
* feature file locations.
*/
sources: ISourcesCoordinates;

@@ -100,17 +160,74 @@ support: ISupportCodeCoordinates;

/**
* Options relating to behaviour when actually running tests
* @public
*/
export interface IRunOptionsRuntime extends IRuntimeOptions {
export interface IRunOptionsRuntime {
/**
* Perform a dry run, where a test run is prepared but nothing is executed
*/
dryRun: boolean;
/**
* Stop running tests when a test fails
*/
failFast: boolean;
/**
* Filter out stack frames from Cucumber's code when formatting stack traces
*/
filterStacktraces: boolean;
/**
* Run tests in parallel with the given number of worker processes
*/
parallel: number;
/**
* Retry failing tests up to the given number of times
*/
retry: number;
/**
* Tag expression to filter which scenarios can be retried
*/
retryTagFilter: string;
/**
* Fail the test run if there are pending steps
*/
strict: boolean;
/**
* Parameters to be passed to the World
* @remarks
* The value must be a JSON-serializable object.
*/
worldParameters: JsonObject;
}
/**
* Options relating to formatters - which ones to use, where to write their
* output, how they should behave
* @public
*/
export interface IRunOptionsFormats {
/**
* Name/path of the formatter to use for `stdout` output
*/
stdout: string;
/**
* Zero or more mappings of file output path (key) to name/path of the
* formatter to use (value)
* @example
* \{
* "./reports/cucumber.html": "html",
* "./reports/custom.txt": "./custom-formatter.js"
* \}
*/
files: Record<string, string>;
/**
* Options for report publication, or `false` to disable publication
*/
publish: IPublishConfig | false;
options: FormatOptions;
/**
* Options to be provided to formatters
* @remarks
* The value must be a JSON-serializable object.
*/
options: JsonObject;
}
/**
* Structured configuration object suitable for passing to {@link runCucumber}
* @public

@@ -125,10 +242,28 @@ */

/**
* A collection of user-defined code and setup ("support code") that can be
* used for a test run
* @public
* @remarks
* This is mostly a marker interface. The actual instance is a complex object
* that you shouldn't interact with directly, but some functions return and/or
* accept it as a means of optimising a test workflow.
*/
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
export interface ISupportCodeLibrary {
readonly originalCoordinates: ISupportCodeCoordinates;
}
/**
* Either an actual {@link ISupportCodeLibrary | support code library}, or the
* {@link ISupportCodeCoordinates | coordinates} required to create and
* populate one
* @public
* @remarks
* This alias exists because {@link runCucumber} will accept an existing
* support code library in its options and thus avoid trying to load it again,
* improving performance and avoiding cache issues for use cases where multiple
* test runs happen within the same process. Note this is only useful in serial
* mode, as parallel workers will each load the support code themselves anyway.
*/
export type { ISupportCodeLibrary };
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
/**
* Options for {@link runCucumber}
* @public

@@ -143,4 +278,3 @@ */

/**
* Contextual data about the project environment.
*
* Contextual data about the project environment
* @public

@@ -150,19 +284,25 @@ */

/**
* Working directory for the project (defaults to `process.cwd()` if omitted).
* Working directory for the project
* @default process.cwd()
*/
cwd?: string;
/**
* Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).
* Writable stream where the test run's main formatter output is written
* @default process.stdout
*/
stdout?: Writable;
/**
* Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).
* Writable stream where the test run's warning/error output is written
* @default process.stderr
*/
stderr?: Writable;
/**
* Environment variables (defaults to `process.env` if omitted).
* Environment variables
* @default process.env
*/
env?: NodeJS.ProcessEnv;
/**
* Whether debug logging is enabled.
* Whether debug logging should be emitted to {@link IRunEnvironment.stderr}
* @default false
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}
*/

@@ -172,4 +312,3 @@ debug?: boolean;

/**
* Result of a Cucumber test run.
*
* Response from {@link runCucumber}
* @public

@@ -179,9 +318,14 @@ */

/**
* Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.
* Whether the test run was overall successful
* @remarks
* The exact meaning can vary based on the `strict` configuration option.
*/
success: boolean;
/**
* The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.
* The support code library that was used in the test run
* @remarks
* This can be reused in subsequent {@link runCucumber} calls,
* see {@link ISupportCodeCoordinatesOrLibrary}
*/
support: ISupportCodeLibrary;
}

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

import PickleFilter from '../pickle_filter';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { PickleOrder } from '../models/pickle_order';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { ILogger } from '../logger';
import { IPickleOrder } from '../filter';
interface IParseGherkinMessageStreamRequest {

@@ -31,9 +31,9 @@ cwd?: string;

export declare function parseGherkinMessageStream({ eventBroadcaster, eventDataCollector, gherkinMessageStream, order, pickleFilter, }: IParseGherkinMessageStreamRequest): Promise<string[]>;
export declare function orderPickles<T = string>(pickleIds: T[], order: PickleOrder, logger: ILogger): void;
export declare function orderPickles<T = string>(pickleIds: T[], order: IPickleOrder, logger: ILogger): void;
export declare function emitMetaMessage(eventBroadcaster: EventEmitter, env: NodeJS.ProcessEnv): Promise<void>;
export declare function emitSupportCodeMessages({ eventBroadcaster, supportCodeLibrary, newId, }: {
eventBroadcaster: EventEmitter;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
newId: IdGenerator.NewId;
}): void;
export {};

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

.of(yup.lazy((val) => Array.isArray(val)
? yup.array().of(yup.string()).min(2).max(2)
? yup.array().of(yup.string()).min(1).max(2)
: yup.string())),

@@ -44,3 +44,3 @@ formatOptions: yup.object(),

name: yup.array().of(yup.string()),
order: yup.string().oneOf(['defined', 'random']),
order: yup.string().matches(/^random:.*|random|defined$/),
paths: yup.array().of(yup.string()),

@@ -47,0 +47,0 @@ parallel: yup.number().integer().min(0),

import { JsonObject } from 'type-fest';
import { FormatOptions } from '../formatter';
import { PickleOrder } from '../models/pickle_order';
type FormatsConfiguration = Array<string | [string, string?]>;
import { IPickleOrder } from '../filter';
/**
* User-defined configuration
*
* @public
*/
export interface IConfiguration {
/**
* Paths to where your feature files are
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}
*/
paths: string[];
/**
* Show the full backtrace for errors
* @default false
*/
backtrace: boolean;
/**
* Perform a dry run, where a test run is prepared but nothing is executed
* @default false
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}
*/
dryRun: boolean;
/**
* Explicitly call `process.exit()` after the test run
* @default false
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}
* @remarks
* This option is only used by the CLI.
*/
forceExit: boolean;
/**
* Stop running tests when a test fails
* @default false
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}
*/
failFast: boolean;
format: FormatsConfiguration;
formatOptions: FormatOptions;
/**
* Name/path and (optionally) output file path of each formatter to use
*
* @example
* [
* "\@cucumber/pretty-formatter",
* ["html", "./reports/cucumber.html"],
* ["./custom-formatter.js", "./reports/custom.txt"]
* ]
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}
* @remarks
* Each item has one or two values. The first (required) identifies the
* formatter to be used. The second (optional) specifies where the output
* should be written.
*/
format: Array<string | [string, string?]>;
/**
* Options to be provided to formatters
* @default \{\}
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}
* @remarks
* The value must be a JSON-serializable object.
*/
formatOptions: JsonObject;
/**
* Paths to where your support code is
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}
*/
import: string[];
/**
* Default language for your feature files
* @default "en"
*/
language: string;
/**
* Regular expressions of which scenario names should match one of to be run
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}
*/
name: string[];
order: PickleOrder;
paths: string[];
/**
* Run in the order defined, or in a random order
* @default "defined"
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}
*/
order: IPickleOrder;
/**
* Run tests in parallel with the given number of worker processes
* @default 0
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}
*/
parallel: number;
/**
* Publish a report of your test run to https://reports.cucumber.io/
* @default false
*/
publish: boolean;
/**
* @deprecated no longer needed; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated no longer needed
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md}
*/
publishQuiet: boolean;
/**
* Paths to where your support code is, for CommonJS
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}
*/
require: string[];
/**
* Names of transpilation modules to load, via `require()`
* @default []
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}
*/
requireModule: string[];
/**
* Retry failing tests up to the given number of times
* @default 0
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}
*/
retry: number;
/**
* Tag expression to filter which scenarios can be retried
* @default ""
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}
*/
retryTagFilter: string;
/**
* Fail the test run if there are pending steps
* @default true
*/
strict: boolean;
/**
* Tag expression to filter which scenarios should be run
* @default ""
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}
*/
tags: string;
/**
* Parameters to be passed to your World
* @default \{\}
* @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}
* @remarks
* The value must be a JSON-serializable object.
*/
worldParameters: JsonObject;
}
export {};
import { GherkinDocument, Location, Pickle } from '@cucumber/messages';
/**
* The ordering strategy for pickles
* @public
* @example "defined"
* @example "random"
* @example "random:234119"
*/
export type IPickleOrder = 'defined' | 'random' | `random:${string}`;
export interface IFilterablePickle {

@@ -3,0 +11,0 @@ pickle: Pickle;

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

import { Writable as WritableStream } from 'node:stream';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax';

@@ -17,3 +17,3 @@ import EventDataCollector from './helpers/event_data_collector';

snippetSyntax?: string;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}

@@ -29,3 +29,3 @@ export interface IBuildOptions {

cleanup: IFormatterCleanupFn;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}

@@ -32,0 +32,0 @@ declare const FormatterBuilder: {

import * as messages from '@cucumber/messages';
import { IColorFns } from '../get_color_fns';
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
import { SupportCodeLibrary } from '../../support_code_library_builder/types';
import { ITestCaseAttempt } from './event_data_collector';

@@ -14,3 +14,3 @@ export declare function isFailure(result: messages.TestStepResult, willBeRetried?: boolean): boolean;

testCaseAttempt: ITestCaseAttempt;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
printAttachments?: boolean;

@@ -17,0 +17,0 @@ }

import { IColorFns } from '../get_color_fns';
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
import { SupportCodeLibrary } from '../../support_code_library_builder/types';
import { ITestCaseAttempt } from './event_data_collector';

@@ -9,5 +9,5 @@ export interface IFormatTestCaseAttemptRequest {

snippetBuilder: StepDefinitionSnippetBuilder;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
printAttachments?: boolean;
}
export declare function formatTestCaseAttempt({ colorFns, snippetBuilder, supportCodeLibrary, testCaseAttempt, printAttachments, }: IFormatTestCaseAttemptRequest): string;
import * as messages from '@cucumber/messages';
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
import { SupportCodeLibrary } from '../../support_code_library_builder/types';
import { ILineAndUri } from '../../types';

@@ -30,4 +30,4 @@ import { ITestCaseAttempt } from './event_data_collector';

snippetBuilder: StepDefinitionSnippetBuilder;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}
export declare function parseTestCaseAttempt({ testCaseAttempt, snippetBuilder, supportCodeLibrary, }: IParseTestCaseAttemptRequest): IParsedTestCaseAttempt;

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

import { EventEmitter } from 'node:events';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
import { IColorFns } from './get_color_fns';

@@ -22,6 +22,2 @@ import { EventDataCollector } from './helpers';

}
export interface IPublishConfig {
url: string;
token: string;
}
export type IFormatterStream = Writable;

@@ -40,3 +36,3 @@ export type IFormatterLogFn = (buffer: string | Uint8Array) => void;

cleanup: IFormatterCleanupFn;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}

@@ -50,3 +46,3 @@ export default class Formatter {

protected stream: Writable;
protected supportCodeLibrary: ISupportCodeLibrary;
protected supportCodeLibrary: SupportCodeLibrary;
protected printAttachments: boolean;

@@ -53,0 +49,0 @@ private readonly cleanup;

@@ -0,1 +1,9 @@

/**
* User code functions and helpers
*
* @packageDocumentation
* @module (root)
* @remarks
* These docs cover the functions and helpers for user code registration and test setup. The entry point is `@cucumber/cucumber`.
*/
import * as messages from '@cucumber/messages';

@@ -8,6 +16,6 @@ import { default as _Cli } from './cli';

import { default as _Runtime } from './runtime';
export declare const version: string;
export { default as supportCodeLibraryBuilder } from './support_code_library_builder';
export { default as DataTable } from './models/data_table';
export { default as TestCaseHookDefinition } from './models/test_case_hook_definition';
export { version } from './version';
export { default as Formatter, IFormatterOptions } from './formatter';

@@ -44,17 +52,17 @@ export { default as FormatterBuilder } from './formatter/builder';

/**
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
export declare const Cli: typeof _Cli;
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
export declare const parseGherkinMessageStream: typeof cliHelpers.parseGherkinMessageStream;
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
export declare const PickleFilter: typeof _PickleFilter;
/**
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
export declare const Runtime: typeof _Runtime;
export { INewRuntimeOptions, IRuntimeOptions } from './runtime';
"use strict";
/**
* User code functions and helpers
*
* @packageDocumentation
* @module (root)
* @remarks
* These docs cover the functions and helpers for user code registration and test setup. The entry point is `@cucumber/cucumber`.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {

@@ -29,3 +37,3 @@ if (k2 === undefined) k2 = k;

Object.defineProperty(exports, "__esModule", { value: true });
exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineParameterType = exports.defineStep = 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.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = void 0;
exports.Runtime = exports.PickleFilter = exports.parseGherkinMessageStream = exports.Cli = exports.wrapPromiseWithTimeout = exports.Status = exports.parallelCanAssignHelpers = exports.World = exports.When = exports.Then = exports.setParallelCanAssign = exports.setWorldConstructor = exports.setDefinitionFunctionWrapper = exports.setDefaultTimeout = exports.Given = exports.defineParameterType = exports.defineStep = 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.TestCaseHookDefinition = exports.DataTable = exports.supportCodeLibraryBuilder = exports.version = void 0;
const node_util_1 = require("node:util");

@@ -42,2 +50,5 @@ const messages = __importStar(require("@cucumber/messages"));

const support_code_library_builder_1 = __importDefault(require("./support_code_library_builder"));
const version_1 = require("./version");
// type version as string to avoid tripping api-extractor every release
exports.version = version_1.version;
// Top level

@@ -50,4 +61,2 @@ var support_code_library_builder_2 = require("./support_code_library_builder");

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

@@ -97,17 +106,17 @@ var formatter_1 = require("./formatter");

/**
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
exports.Cli = (0, node_util_1.deprecate)(cli_1.default, '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
exports.parseGherkinMessageStream = (0, node_util_1.deprecate)(cliHelpers.parseGherkinMessageStream, '`parseGherkinMessageStream` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
/**
* @deprecated use `loadSources` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
exports.PickleFilter = (0, node_util_1.deprecate)(pickle_filter_1.default, '`PickleFilter` is deprecated, use `loadSources` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
/**
* @deprecated use `runCucumber` instead; see <https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md>
* @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md
*/
exports.Runtime = (0, node_util_1.deprecate)(runtime_1.default, '`Runtime` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
//# sourceMappingURL=index.js.map
import { publishPlugin } from './publish_plugin';
export default publishPlugin;
export * from './types';
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
const publish_plugin_1 = require("./publish_plugin");
exports.default = publish_plugin_1.publishPlugin;
__exportStar(require("./types"), exports);
//# sourceMappingURL=index.js.map
import { InternalPlugin } from '../plugin';
import { IPublishConfig } from '../formatter';
import { IPublishConfig } from './types';
export declare const publishPlugin: InternalPlugin<IPublishConfig | false>;

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

import { IdGenerator } from '@cucumber/messages';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
export declare type IAssembledTestCases = Record<string, messages.TestCase>;

@@ -12,4 +12,4 @@ export interface IAssembleTestCasesOptions {

pickles: messages.Pickle[];
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}
export declare function assembleTestCases({ eventBroadcaster, newId, pickles, supportCodeLibrary, }: IAssembleTestCasesOptions): Promise<IAssembledTestCases>;

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

import { EventDataCollector } from '../formatter/helpers';
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
import { SupportCodeLibrary } from '../support_code_library_builder/types';
export interface IRuntime {

@@ -18,3 +18,3 @@ start: () => Promise<boolean>;

pickleIds: string[];
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
}

@@ -21,0 +21,0 @@ export interface IRuntimeOptions {

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

import { IRuntime, IRuntimeOptions } from '..';
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
import { SupportCodeLibrary } from '../../support_code_library_builder/types';
import { ILogger } from '../../logger';

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

pickleIds: string[];
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
requireModules: string[];

@@ -24,0 +24,0 @@ requirePaths: string[];

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

import { JsonObject } from 'type-fest';
import { ISupportCodeLibrary, ITestCaseHookParameter } from '../support_code_library_builder/types';
import { SupportCodeLibrary, ITestCaseHookParameter } from '../support_code_library_builder/types';
import TestCaseHookDefinition from '../models/test_case_hook_definition';

@@ -22,3 +22,3 @@ import TestStepHookDefinition from '../models/test_step_hook_definition';

filterStackTraces: boolean;
supportCodeLibrary: ISupportCodeLibrary;
supportCodeLibrary: SupportCodeLibrary;
worldParameters: JsonObject;

@@ -25,0 +25,0 @@ }

@@ -9,3 +9,3 @@ import { IdGenerator } from '@cucumber/messages';

import { GherkinStepKeyword } from '../models/gherkin_step_keyword';
import { IDefineSupportCodeMethods, IDefineTestCaseHookOptions, IDefineTestStepHookOptions, IDefineTestRunHookOptions, IParameterTypeDefinition, ISupportCodeLibrary, TestCaseHookFunction, TestStepHookFunction, ISupportCodeCoordinates, IDefineStep } from './types';
import { IDefineSupportCodeMethods, IDefineTestCaseHookOptions, IDefineTestStepHookOptions, IDefineTestRunHookOptions, IParameterTypeDefinition, SupportCodeLibrary, TestCaseHookFunction, TestStepHookFunction, ISupportCodeCoordinates, IDefineStep } from './types';
interface IStepDefinitionConfig {

@@ -71,3 +71,3 @@ code: any;

};
finalize(canonicalIds?: ICanonicalSupportCodeIds): ISupportCodeLibrary;
finalize(canonicalIds?: ICanonicalSupportCodeIds): SupportCodeLibrary;
reset(cwd: string, newId: IdGenerator.NewId, originalCoordinates?: ISupportCodeCoordinates): void;

@@ -74,0 +74,0 @@ }

@@ -78,3 +78,3 @@ import * as messages from '@cucumber/messages';

}
export interface ISupportCodeLibrary {
export interface SupportCodeLibrary {
readonly originalCoordinates: ISupportCodeCoordinates;

@@ -81,0 +81,0 @@ readonly afterTestCaseHookDefinitions: TestCaseHookDefinition[];

@@ -1,1 +0,1 @@

export declare const version = "10.1.0";
export declare const version = "10.2.1";

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

// Generated by genversion.
exports.version = '10.1.0';
exports.version = '10.2.1';
//# sourceMappingURL=version.js.map

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

],
"version": "10.1.0",
"version": "10.2.1",
"homepage": "https://github.com/cucumber/cucumber-js",

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

"@cucumber/query": "12.0.1",
"@microsoft/api-documenter": "7.19.27",
"@microsoft/api-extractor": "7.33.7",
"@microsoft/api-extractor": "7.39.0",
"@sinonjs/fake-timers": "10.0.2",

@@ -310,2 +309,4 @@ "@types/chai": "4.3.4",

"tsd": "0.25.0",
"typedoc": "^0.25.4",
"typedoc-plugin-extras": "^3.0.0",
"typescript": "4.9.4"

@@ -319,4 +320,5 @@ },

"cck-test": "mocha 'compatibility/**/*_spec.ts'",
"docs:ci": "api-extractor run --verbose",
"docs:local": "api-extractor run --verbose --local && api-documenter markdown --input-folder ./tmp/api-extractor --output-folder ./docs/api",
"exports-generate-docs": "typedoc",
"exports-test": "api-extractor run --config exports/api/api-extractor.json --verbose && api-extractor run --config exports/root/api-extractor.json --verbose",
"exports-update": "api-extractor run --config exports/api/api-extractor.json --verbose --local && api-extractor run --config exports/root/api-extractor.json --verbose --local",
"feature-test": "node bin/cucumber.js",

@@ -329,2 +331,5 @@ "lint-code-autofix": "eslint --fix \"{compatibility,example,features,scripts,src,test}/**/*.ts\"",

"lint": "npm run lint-code && npm run lint-format && npm run lint-dependencies",
"preexports-generate-docs": "npm run build-local",
"preexports-test": "npm run build-local",
"preexports-update": "npm run build-local",
"prelint-autofix": "npm run build-local",

@@ -338,3 +343,3 @@ "prelint-code": "npm run build-local",

"test-coverage": "nyc --silent mocha 'src/**/*_spec.ts' 'compatibility/**/*_spec.ts' && nyc --silent --no-clean node bin/cucumber.js --tags \"not @source-mapping\" && nyc report --reporter=lcov",
"test": "npm run lint && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
"test": "npm run lint && npm run exports-test && npm run types-test && npm run unit-test && npm run cck-test && npm run feature-test",
"types-test": "tsd",

@@ -341,0 +346,0 @@ "unit-test": "mocha 'src/**/*_spec.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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc