@cucumber/cucumber 10.3.0 → 10.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/api/types.d.ts +4 -2
- package/lib/api/types.js.map +1 -1
- package/lib/configuration/parse_configuration.d.ts +1 -1
- package/lib/configuration/parse_configuration.js +9 -0
- package/lib/configuration/parse_configuration.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
package/lib/api/types.d.ts
CHANGED
|
@@ -29,11 +29,13 @@ export interface ILoadConfigurationOptions {
|
|
|
29
29
|
* failFast: true,
|
|
30
30
|
* parallel: 2
|
|
31
31
|
* \}
|
|
32
|
+
* @example ["--fail-fast", "--parallel", "2"]
|
|
32
33
|
* @example "--fail-fast --parallel 2"
|
|
33
34
|
* @remarks
|
|
34
|
-
* This can also be provided as
|
|
35
|
+
* This can also be provided as an array or single string of argv-style
|
|
36
|
+
* arguments.
|
|
35
37
|
*/
|
|
36
|
-
provided?: Partial<IConfiguration> | string;
|
|
38
|
+
provided?: Partial<IConfiguration> | string[] | string;
|
|
37
39
|
}
|
|
38
40
|
/**
|
|
39
41
|
* Response from {@link loadConfiguration}
|
package/lib/api/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { JsonObject } from 'type-fest'\nimport { IPublishConfig } from '../publish'\nimport { IConfiguration } from '../configuration'\nimport { IPickleOrder } from '../filter'\n\n/**\n * Options for {@link loadConfiguration}\n * @public\n */\nexport interface ILoadConfigurationOptions {\n /**\n * Path to load configuration file from, or `false` to skip\n * @default `cucumber.(json|yaml|yml|js|cjs|mjs)`\n */\n file?: string | false\n /**\n * Zero or more profile names from which to source configuration in the file\n * @remarks\n * If omitted or empty, the `default` profile will be used.\n */\n profiles?: string[]\n /**\n * Ad-hoc configuration options to be merged over the top of whatever is\n * loaded from the configuration file/profiles\n * @example\n * \\{\n * failFast: true,\n * parallel: 2\n * \\}\n * @example [\"--fail-fast\", \"--parallel\", \"2\"]\n * @example \"--fail-fast --parallel 2\"\n * @remarks\n * This can also be provided as an array or single string of argv-style\n * arguments.\n */\n provided?: Partial<IConfiguration> | string[] | string\n}\n\n/**\n * Response from {@link loadConfiguration}\n * @public\n */\nexport interface IResolvedConfiguration {\n /**\n * The final flat configuration object resolved from the configuration\n * file/profiles plus any extra provided\n */\n useConfiguration: IConfiguration\n /**\n * The format that can be passed into {@link runCucumber}\n */\n runConfiguration: IRunConfiguration\n}\n\n/**\n * Options relating to sources (i.e. feature files) - where to load them from,\n * how to interpret, filter and order them\n * @public\n */\nexport interface ISourcesCoordinates {\n /**\n * Default Gherkin dialect\n * @remarks\n * Used if no dialect is specified in the feature file itself.\n */\n defaultDialect: string\n /**\n * Paths and/or glob expressions to feature files\n */\n paths: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n */\n names: string[]\n /**\n * Tag expression to filter which scenarios should be run\n */\n tagExpression: string\n /**\n * Run in the order defined, or in a random order\n */\n order: IPickleOrder\n}\n\n/**\n * A pickle that has been successfully compiled from a source\n * @public\n */\nexport interface IPlannedPickle {\n /**\n * Name of the pickle (after parameter resolution)\n */\n name: string\n uri: string\n location: {\n line: number\n column?: number\n }\n}\n\n/**\n * An error encountered when parsing a source\n * @public\n */\nexport interface ISourcesError {\n uri: string\n location: {\n line: number\n column?: number\n }\n /**\n * Error message explaining what went wrong with the parse\n */\n message: string\n}\n\n/**\n * Response from {@link loadSources}\n * @public\n */\nexport interface ILoadSourcesResult {\n /**\n * Pickles that have been successfully compiled, in the order they would be\n * run in\n */\n plan: IPlannedPickle[]\n /**\n * Any errors encountered when parsing sources\n */\n errors: ISourcesError[]\n}\n\n/**\n * Options relating to user code (aka support code) - where to load it from and\n * how to preprocess it\n * @public\n */\nexport interface ISupportCodeCoordinates {\n /**\n * Names of transpilation modules to load, via `require()`\n */\n requireModules: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `require()`\n */\n requirePaths: string[]\n /**\n * Paths and/or glob expressions of user code to load, via `import()`\n */\n importPaths: string[]\n}\n\n/**\n * Options for {@link loadSupport}\n * @public\n * @remarks\n * A subset of {@link IRunConfiguration}\n */\nexport interface ILoadSupportOptions {\n /**\n * @remarks\n * This is needed because the default support path locations are derived from\n * feature file locations.\n */\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n}\n\n/**\n * Options relating to behaviour when actually running tests\n * @public\n */\nexport interface IRunOptionsRuntime {\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n */\n dryRun: boolean\n /**\n * Stop running tests when a test fails\n */\n failFast: boolean\n /**\n * Filter out stack frames from Cucumber's code when formatting stack traces\n */\n filterStacktraces: boolean\n /**\n * Run tests in parallel with the given number of worker processes\n */\n parallel: number\n /**\n * Retry failing tests up to the given number of times\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n */\n strict: boolean\n /**\n * Parameters to be passed to the World\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Options relating to formatters - which ones to use, where to write their\n * output, how they should behave\n * @public\n */\nexport interface IRunOptionsFormats {\n /**\n * Name/path of the formatter to use for `stdout` output\n */\n stdout: string\n /**\n * Zero or more mappings of file output path (key) to name/path of the\n * formatter to use (value)\n * @example\n * \\{\n * \"./reports/cucumber.html\": \"html\",\n * \"./reports/custom.txt\": \"./custom-formatter.js\"\n * \\}\n */\n files: Record<string, string>\n /**\n * Options for report publication, or `false` to disable publication\n */\n publish: IPublishConfig | false\n /**\n * Options to be provided to formatters\n * @remarks\n * The value must be a JSON-serializable object.\n */\n options: JsonObject\n}\n\n/**\n * Structured configuration object suitable for passing to {@link runCucumber}\n * @public\n */\nexport interface IRunConfiguration {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinates\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * A collection of user-defined code and setup (\"support code\") that can be\n * used for a test run\n * @public\n * @remarks\n * This is mostly a marker interface. The actual instance is a complex object\n * that you shouldn't interact with directly, but some functions return and/or\n * accept it as a means of optimising a test workflow.\n */\nexport interface ISupportCodeLibrary {\n readonly originalCoordinates: ISupportCodeCoordinates\n}\n\n/**\n * Either an actual {@link ISupportCodeLibrary | support code library}, or the\n * {@link ISupportCodeCoordinates | coordinates} required to create and\n * populate one\n * @public\n * @remarks\n * This alias exists because {@link runCucumber} will accept an existing\n * support code library in its options and thus avoid trying to load it again,\n * improving performance and avoiding cache issues for use cases where multiple\n * test runs happen within the same process. Note this is only useful in serial\n * mode, as parallel workers will each load the support code themselves anyway.\n */\nexport type ISupportCodeCoordinatesOrLibrary =\n | ISupportCodeCoordinates\n | ISupportCodeLibrary\n\n/**\n * Options for {@link runCucumber}\n * @public\n */\nexport interface IRunOptions {\n sources: ISourcesCoordinates\n support: ISupportCodeCoordinatesOrLibrary\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n}\n\n/**\n * Contextual data about the project environment\n * @public\n */\nexport interface IRunEnvironment {\n /**\n * Working directory for the project\n * @default process.cwd()\n */\n cwd?: string\n /**\n * Writable stream where the test run's main formatter output is written\n * @default process.stdout\n */\n stdout?: Writable\n /**\n * Writable stream where the test run's warning/error output is written\n * @default process.stderr\n */\n stderr?: Writable\n /**\n * Environment variables\n * @default process.env\n */\n env?: NodeJS.ProcessEnv\n /**\n * Whether debug logging should be emitted to {@link IRunEnvironment.stderr}\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/debugging.md}\n */\n debug?: boolean\n}\n\n/**\n * Response from {@link runCucumber}\n * @public\n */\nexport interface IRunResult {\n /**\n * Whether the test run was overall successful\n * @remarks\n * The exact meaning can vary based on the `strict` configuration option.\n */\n success: boolean\n /**\n * The support code library that was used in the test run\n * @remarks\n * This can be reused in subsequent {@link runCucumber} calls,\n * see {@link ISupportCodeCoordinatesOrLibrary}\n */\n support: ISupportCodeLibrary\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ILogger } from '../logger';
|
|
2
2
|
import { IConfiguration } from './types';
|
|
3
|
-
export declare function parseConfiguration(logger: ILogger, source: string, definition: Partial<IConfiguration> | string | undefined): Partial<IConfiguration>;
|
|
3
|
+
export declare function parseConfiguration(logger: ILogger, source: string, definition: Partial<IConfiguration> | string[] | string | undefined): Partial<IConfiguration>;
|
|
@@ -11,6 +11,15 @@ function parseConfiguration(logger, source, definition) {
|
|
|
11
11
|
if (!definition) {
|
|
12
12
|
return {};
|
|
13
13
|
}
|
|
14
|
+
if (Array.isArray(definition)) {
|
|
15
|
+
logger.debug(`${source} configuration value is an array; parsing as argv`);
|
|
16
|
+
const { configuration } = argv_parser_1.default.parse([
|
|
17
|
+
'node',
|
|
18
|
+
'cucumber-js',
|
|
19
|
+
...definition,
|
|
20
|
+
]);
|
|
21
|
+
return configuration;
|
|
22
|
+
}
|
|
14
23
|
if (typeof definition === 'string') {
|
|
15
24
|
logger.debug(`${source} configuration value is a string; parsing as argv`);
|
|
16
25
|
const { configuration } = argv_parser_1.default.parse([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse_configuration.js","sourceRoot":"","sources":["../../src/configuration/parse_configuration.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AAGpC,gEAAsC;AACtC,iDAA4C;AAE5C,SAAgB,kBAAkB,CAChC,MAAe,EACf,MAAc,EACd,
|
|
1
|
+
{"version":3,"file":"parse_configuration.js","sourceRoot":"","sources":["../../src/configuration/parse_configuration.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAoC;AAGpC,gEAAsC;AACtC,iDAA4C;AAE5C,SAAgB,kBAAkB,CAChC,MAAe,EACf,MAAc,EACd,UAAmE;IAEnE,IAAI,CAAC,UAAU,EAAE;QACf,OAAO,EAAE,CAAA;KACV;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC7B,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,UAAU;SACd,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE;QAClC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,mDAAmD,CAAC,CAAA;QAC1E,MAAM,EAAE,aAAa,EAAE,GAAG,qBAAU,CAAC,KAAK,CAAC;YACzC,MAAM;YACN,aAAa;YACb,GAAG,IAAA,qBAAU,EAAC,UAAU,CAAC;SAC1B,CAAC,CAAA;QACF,OAAO,aAAa,CAAA;KACrB;IACD,IAAI;QACF,OAAO,IAAA,0BAAW,EAAC,UAAU,CAAC,CAAA;KAC/B;IAAC,OAAO,KAAK,EAAE;QACd,MAAM,IAAI,KAAK,CACb,GAAG,MAAM,kDAAkD,KAAK,CAAC,MAAM,CAAC,IAAI,CAC1E,GAAG,CACJ,EAAE,CACJ,CAAA;KACF;AACH,CAAC;AAnCD,gDAmCC","sourcesContent":["import stringArgv from 'string-argv'\nimport { ILogger } from '../logger'\nimport { IConfiguration } from './types'\nimport ArgvParser from './argv_parser'\nimport { checkSchema } from './check_schema'\n\nexport function parseConfiguration(\n logger: ILogger,\n source: string,\n definition: Partial<IConfiguration> | string[] | string | undefined\n): Partial<IConfiguration> {\n if (!definition) {\n return {}\n }\n if (Array.isArray(definition)) {\n logger.debug(`${source} configuration value is an array; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...definition,\n ])\n return configuration\n }\n if (typeof definition === 'string') {\n logger.debug(`${source} configuration value is a string; parsing as argv`)\n const { configuration } = ArgvParser.parse([\n 'node',\n 'cucumber-js',\n ...stringArgv(definition),\n ])\n return configuration\n }\n try {\n return checkSchema(definition)\n } catch (error) {\n throw new Error(\n `${source} configuration value failed schema validation: ${error.errors.join(\n ' '\n )}`\n )\n }\n}\n"]}
|
package/lib/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "10.3.
|
|
1
|
+
export declare const version = "10.3.1";
|
package/lib/version.js
CHANGED
package/lib/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '10.3.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AACd,QAAA,OAAO,GAAG,QAAQ,CAAA","sourcesContent":["// Generated by genversion.\nexport const version = '10.3.1'\n"]}
|