@cucumber/cucumber 12.4.0 → 12.5.0
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/README.md +2 -0
- package/lib/api/convert_configuration.js +4 -0
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/index.d.ts +4 -2
- package/lib/api/index.js.map +1 -1
- package/lib/api/plugins.d.ts +1 -1
- package/lib/api/plugins.js +51 -2
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/types.d.ts +25 -0
- package/lib/api/types.js.map +1 -1
- package/lib/configuration/argv_parser.d.ts +2 -0
- package/lib/configuration/argv_parser.js +2 -0
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/default_configuration.js +2 -0
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/types.d.ts +20 -0
- package/lib/configuration/types.js.map +1 -1
- package/lib/environment/console_logger.d.ts +1 -0
- package/lib/environment/console_logger.js +3 -0
- package/lib/environment/console_logger.js.map +1 -1
- package/lib/environment/types.d.ts +7 -0
- package/lib/environment/types.js.map +1 -1
- package/lib/filter/filter_plugin.d.ts +2 -3
- package/lib/filter/filter_plugin.js +3 -3
- package/lib/filter/filter_plugin.js.map +1 -1
- package/lib/filter/types.d.ts +4 -0
- package/lib/filter/types.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.js +0 -1
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/paths/types.d.ts +7 -0
- package/lib/paths/types.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +9 -7
- package/lib/plugin/plugin_manager.js +67 -16
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +120 -32
- package/lib/plugin/types.js.map +1 -1
- package/lib/publish/publish_plugin.d.ts +2 -3
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/sharding/sharding_plugin.d.ts +2 -3
- package/lib/sharding/sharding_plugin.js +2 -2
- package/lib/sharding/sharding_plugin.js.map +1 -1
- package/lib/tsconfig.node.tsbuildinfo +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 +6 -6
- package/lib/plugin/events.d.ts +0 -2
- package/lib/plugin/events.js +0 -9
- package/lib/plugin/events.js.map +0 -1
package/README.md
CHANGED
|
@@ -113,9 +113,11 @@ The following documentation is for `main`, which might contain some unreleased f
|
|
|
113
113
|
* [Filtering which scenarios run](./docs/filtering.md)
|
|
114
114
|
* [Formatters for feedback and reporting](./docs/formatters.md)
|
|
115
115
|
* [Parallel running for speed](./docs/parallel.md)
|
|
116
|
+
* [Plugins for extending functionality](./docs/plugins.md)
|
|
116
117
|
* [Profiles for composable configuration](./docs/profiles.md)
|
|
117
118
|
* [Rerunning just failures](./docs/rerun.md)
|
|
118
119
|
* [Retrying flaky scenarios](./docs/retry.md)
|
|
120
|
+
* [Sharding to split tests across machines](./docs/sharding.md)
|
|
119
121
|
* [JavaScript API for running programmatically](./docs/javascript_api.md)
|
|
120
122
|
* [Snippets for undefined steps](./docs/snippets.md)
|
|
121
123
|
* [Transpiling (from TypeScript etc)](./docs/transpiling.md)
|
|
@@ -29,6 +29,10 @@ async function convertConfiguration(logger, flatConfiguration, env) {
|
|
|
29
29
|
worldParameters: flatConfiguration.worldParameters,
|
|
30
30
|
},
|
|
31
31
|
formats: convertFormats(logger, flatConfiguration, env),
|
|
32
|
+
plugins: {
|
|
33
|
+
specifiers: flatConfiguration.plugin,
|
|
34
|
+
options: flatConfiguration.pluginOptions,
|
|
35
|
+
},
|
|
32
36
|
};
|
|
33
37
|
}
|
|
34
38
|
function convertFormats(logger, flatConfiguration, env) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;AASA,
|
|
1
|
+
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;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C","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../publish'\nimport { ILogger } from '../environment'\nimport { IRunConfiguration } from './types'\n\nexport async function convertConfiguration(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): Promise<IRunConfiguration> {\n return {\n sources: {\n paths: flatConfiguration.paths,\n defaultDialect: flatConfiguration.language,\n names: flatConfiguration.name,\n tagExpression: flatConfiguration.tags,\n order: flatConfiguration.order,\n shard: flatConfiguration.shard,\n },\n support: {\n requireModules: flatConfiguration.requireModule,\n requirePaths: flatConfiguration.require,\n importPaths: flatConfiguration.import,\n loaders: flatConfiguration.loader,\n },\n runtime: {\n dryRun: flatConfiguration.dryRun,\n failFast: flatConfiguration.failFast,\n filterStacktraces: !flatConfiguration.backtrace,\n parallel: flatConfiguration.parallel,\n retry: flatConfiguration.retry,\n retryTagFilter: flatConfiguration.retryTagFilter,\n strict: flatConfiguration.strict,\n worldParameters: flatConfiguration.worldParameters,\n },\n formats: convertFormats(logger, flatConfiguration, env),\n plugins: {\n specifiers: flatConfiguration.plugin,\n options: flatConfiguration.pluginOptions,\n },\n }\n}\n\nfunction convertFormats(\n logger: ILogger,\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n) {\n const splitFormats: string[][] = flatConfiguration.format.map((item) =>\n Array.isArray(item) ? item : splitFormatDescriptor(logger, item)\n )\n return {\n stdout:\n [...splitFormats].reverse().find(([, target]) => !target)?.[0] ??\n 'progress',\n files: splitFormats\n .filter(([, target]) => !!target)\n .reduce((mapped, [type, target]) => {\n return {\n ...mapped,\n [target]: type,\n }\n }, {}),\n publish: makePublishConfig(flatConfiguration, env),\n options: flatConfiguration.formatOptions,\n }\n}\n\nfunction makePublishConfig(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): IPublishConfig | false {\n const enabled = isPublishing(flatConfiguration, env)\n if (!enabled) {\n return false\n }\n return {\n url: env.CUCUMBER_PUBLISH_URL,\n token: env.CUCUMBER_PUBLISH_TOKEN,\n }\n}\n\nfunction isPublishing(\n flatConfiguration: IConfiguration,\n env: NodeJS.ProcessEnv\n): boolean {\n return (\n flatConfiguration.publish ||\n isTruthyString(env.CUCUMBER_PUBLISH_ENABLED) ||\n env.CUCUMBER_PUBLISH_TOKEN !== undefined\n )\n}\n"]}
|
package/lib/api/index.d.ts
CHANGED
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
* These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.
|
|
8
8
|
*/
|
|
9
9
|
export { IConfiguration } from '../configuration';
|
|
10
|
-
export { IRunEnvironment } from '../environment';
|
|
11
|
-
export { IPickleOrder } from '../filter';
|
|
10
|
+
export { ILogger, IRunEnvironment } from '../environment';
|
|
11
|
+
export { IFilterablePickle, IPickleOrder } from '../filter';
|
|
12
|
+
export { IResolvedPaths } from '../paths';
|
|
13
|
+
export { CoordinatorEventKey, CoordinatorEventValues, CoordinatorEventHandler, CoordinatorTransformKey, CoordinatorTransformValues, CoordinatorTransformer, CoordinatorContext, CoordinatorEnvironment, Plugin, PluginCleanup, PluginOperation, } from '../plugin';
|
|
12
14
|
export { IPublishConfig } from '../publish';
|
|
13
15
|
export * from './load_configuration';
|
|
14
16
|
export * from './load_sources';
|
package/lib/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;AAoBH,uDAAoC;AACpC,iDAA8B;AAC9B,iDAA8B;AAC9B,iDAA8B;AAC9B,0CAAuB","sourcesContent":["/**\n * JavaScript API for running and extending Cucumber\n *\n * @packageDocumentation\n * @module api\n * @remarks\n * These docs cover the API used for running Cucumber programmatically. The entry point is `@cucumber/cucumber/api`.\n */\n\nexport { IConfiguration } from '../configuration'\nexport { ILogger, IRunEnvironment } from '../environment'\nexport { IFilterablePickle, IPickleOrder } from '../filter'\nexport { IResolvedPaths } from '../paths'\nexport {\n CoordinatorEventKey,\n CoordinatorEventValues,\n CoordinatorEventHandler,\n CoordinatorTransformKey,\n CoordinatorTransformValues,\n CoordinatorTransformer,\n CoordinatorContext,\n CoordinatorEnvironment,\n Plugin,\n PluginCleanup,\n PluginOperation,\n} from '../plugin'\nexport { IPublishConfig } from '../publish'\nexport * from './load_configuration'\nexport * from './load_sources'\nexport * from './load_support'\nexport * from './run_cucumber'\nexport * from './types'\n"]}
|
package/lib/api/plugins.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PluginManager } from '../plugin';
|
|
2
1
|
import { UsableEnvironment } from '../environment';
|
|
2
|
+
import { PluginManager } from '../plugin';
|
|
3
3
|
import { IRunConfiguration, ISourcesCoordinates } from './types';
|
|
4
4
|
export declare function initializeForLoadSources(coordinates: ISourcesCoordinates, environment: UsableEnvironment): Promise<PluginManager>;
|
|
5
5
|
export declare function initializeForLoadSupport(environment: UsableEnvironment): Promise<PluginManager>;
|
package/lib/api/plugins.js
CHANGED
|
@@ -6,10 +6,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.initializeForLoadSources = initializeForLoadSources;
|
|
7
7
|
exports.initializeForLoadSupport = initializeForLoadSupport;
|
|
8
8
|
exports.initializeForRunCucumber = initializeForRunCucumber;
|
|
9
|
+
const node_url_1 = require("node:url");
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const filter_1 = __importDefault(require("../filter"));
|
|
9
12
|
const plugin_1 = require("../plugin");
|
|
10
13
|
const publish_1 = __importDefault(require("../publish"));
|
|
11
|
-
const filter_1 = __importDefault(require("../filter"));
|
|
12
14
|
const sharding_1 = __importDefault(require("../sharding"));
|
|
15
|
+
const value_checker_1 = require("../value_checker");
|
|
16
|
+
async function importPlugin(specifier, cwd) {
|
|
17
|
+
try {
|
|
18
|
+
let normalized = specifier;
|
|
19
|
+
if (specifier.startsWith('.')) {
|
|
20
|
+
normalized = (0, node_url_1.pathToFileURL)(node_path_1.default.resolve(cwd, specifier));
|
|
21
|
+
}
|
|
22
|
+
else if (specifier.startsWith('file://')) {
|
|
23
|
+
normalized = new URL(specifier);
|
|
24
|
+
}
|
|
25
|
+
return await import(normalized.toString());
|
|
26
|
+
}
|
|
27
|
+
catch (e) {
|
|
28
|
+
throw new Error(`Failed to import plugin ${specifier}`, {
|
|
29
|
+
cause: e,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function findPlugin(imported) {
|
|
34
|
+
return findPluginRecursive(imported, 3);
|
|
35
|
+
}
|
|
36
|
+
function findPluginRecursive(thing, depth) {
|
|
37
|
+
if ((0, value_checker_1.doesNotHaveValue)(thing)) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (typeof thing === 'object' && thing.type === 'plugin') {
|
|
41
|
+
return thing;
|
|
42
|
+
}
|
|
43
|
+
depth--;
|
|
44
|
+
if (depth > 0) {
|
|
45
|
+
return findPluginRecursive(thing.default, depth);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
async function loadPlugin(specifier, cwd) {
|
|
50
|
+
const imported = await importPlugin(specifier, cwd);
|
|
51
|
+
const found = findPlugin(imported);
|
|
52
|
+
if (!found) {
|
|
53
|
+
throw new Error(`${specifier} does not export a plugin`);
|
|
54
|
+
}
|
|
55
|
+
return found;
|
|
56
|
+
}
|
|
13
57
|
async function initializeForLoadSources(coordinates, environment) {
|
|
14
58
|
// eventually we'll load plugin packages here
|
|
15
59
|
const pluginManager = new plugin_1.PluginManager(environment);
|
|
@@ -21,11 +65,16 @@ async function initializeForLoadSupport(environment) {
|
|
|
21
65
|
return new plugin_1.PluginManager(environment);
|
|
22
66
|
}
|
|
23
67
|
async function initializeForRunCucumber(configuration, environment) {
|
|
24
|
-
// eventually we'll load plugin packages here
|
|
25
68
|
const pluginManager = new plugin_1.PluginManager(environment);
|
|
26
69
|
await pluginManager.initCoordinator('runCucumber', publish_1.default, configuration.formats.publish);
|
|
27
70
|
await pluginManager.initCoordinator('runCucumber', filter_1.default, configuration.sources);
|
|
28
71
|
await pluginManager.initCoordinator('runCucumber', sharding_1.default, configuration.sources);
|
|
72
|
+
if (configuration.plugins) {
|
|
73
|
+
for (const specifier of configuration.plugins.specifiers) {
|
|
74
|
+
const plugin = await loadPlugin(specifier, environment.cwd);
|
|
75
|
+
await pluginManager.initCoordinator('runCucumber', plugin, configuration.plugins.options, specifier);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
29
78
|
return pluginManager;
|
|
30
79
|
}
|
|
31
80
|
//# sourceMappingURL=plugins.js.map
|
package/lib/api/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;AAqDA,4DAQC;AAED,4DAKC;AAED,4DAmCC;AAzGD,uCAAwC;AACxC,0DAA4B;AAE5B,uDAAoC;AACpC,sCAAiD;AACjD,yDAAsC;AACtC,2DAAwC;AACxC,oDAAmD;AAGnD,KAAK,UAAU,YAAY,CAAC,SAAiB,EAAE,GAAW;IACxD,IAAI,CAAC;QACH,IAAI,UAAU,GAAiB,SAAS,CAAA;QACxC,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,UAAU,GAAG,IAAA,wBAAa,EAAC,mBAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAA;QAC1D,CAAC;aAAM,IAAI,SAAS,CAAC,UAAU,C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;IAE9B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;IACpD,MAAM,aAAa,CAAC,eAAe,CAAC,aAAa,EAAE,gBAAY,EAAE,WAAW,CAAC,CAAA;IAC7E,OAAO,aAAa,CAAA;AACtB,CAAC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,WAA8B;IAE9B,6CAA6C;IAC7C,OAAO,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;AACvC,CAAC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,aAAgC,EAChC,WAA8B;IAE9B,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,WAAW,CAAC,CAAA;IAEpD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,iBAAa,EACb,aAAa,CAAC,OAAO,CAAC,OAAO,CAC9B,CAAA;IACD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,aAAa,CAAC,OAAO,CACtB,CAAA;IACD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,kBAAc,EACd,aAAa,CAAC,OAAO,CACtB,CAAA;IAED,IAAI,aAAa,CAAC,OAAO,EAAE,CAAC;QAC1B,KAAK,MAAM,SAAS,IAAI,aAAa,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACzD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;YAC3D,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,MAAM,EACN,aAAa,CAAC,OAAO,CAAC,OAAO,EAC7B,SAAS,CACV,CAAA;QACH,CAAC;IACH,CAAC;IAED,OAAO,aAAa,CAAA;AACtB,CAAC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport path from 'node:path'\nimport { UsableEnvironment } from '../environment'\nimport filterPlugin from '../filter'\nimport { PluginManager, Plugin } from '../plugin'\nimport publishPlugin from '../publish'\nimport shardingPlugin from '../sharding'\nimport { doesNotHaveValue } from '../value_checker'\nimport { IRunConfiguration, ISourcesCoordinates } from './types'\n\nasync function importPlugin(specifier: string, cwd: string): Promise<any> {\n try {\n let normalized: URL | string = specifier\n if (specifier.startsWith('.')) {\n normalized = pathToFileURL(path.resolve(cwd, specifier))\n } else if (specifier.startsWith('file://')) {\n normalized = new URL(specifier)\n }\n return await import(normalized.toString())\n } catch (e) {\n throw new Error(`Failed to import plugin ${specifier}`, {\n cause: e,\n })\n }\n}\n\nfunction findPlugin(imported: any): Plugin | null {\n return findPluginRecursive(imported, 3)\n}\n\nfunction findPluginRecursive(thing: any, depth: number): Plugin | null {\n if (doesNotHaveValue(thing)) {\n return null\n }\n if (typeof thing === 'object' && thing.type === 'plugin') {\n return thing\n }\n depth--\n if (depth > 0) {\n return findPluginRecursive(thing.default, depth)\n }\n return null\n}\n\nasync function loadPlugin(specifier: string, cwd: string): Promise<Plugin> {\n const imported = await importPlugin(specifier, cwd)\n const found = findPlugin(imported)\n if (!found) {\n throw new Error(`${specifier} does not export a plugin`)\n }\n return found\n}\n\nexport async function initializeForLoadSources(\n coordinates: ISourcesCoordinates,\n environment: UsableEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager(environment)\n await pluginManager.initCoordinator('loadSources', filterPlugin, coordinates)\n return pluginManager\n}\n\nexport async function initializeForLoadSupport(\n environment: UsableEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n return new PluginManager(environment)\n}\n\nexport async function initializeForRunCucumber(\n configuration: IRunConfiguration,\n environment: UsableEnvironment\n): Promise<PluginManager> {\n const pluginManager = new PluginManager(environment)\n\n await pluginManager.initCoordinator(\n 'runCucumber',\n publishPlugin,\n configuration.formats.publish\n )\n await pluginManager.initCoordinator(\n 'runCucumber',\n filterPlugin,\n configuration.sources\n )\n await pluginManager.initCoordinator(\n 'runCucumber',\n shardingPlugin,\n configuration.sources\n )\n\n if (configuration.plugins) {\n for (const specifier of configuration.plugins.specifiers) {\n const plugin = await loadPlugin(specifier, environment.cwd)\n await pluginManager.initCoordinator(\n 'runCucumber',\n plugin,\n configuration.plugins.options,\n specifier\n )\n }\n }\n\n return pluginManager\n}\n"]}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -239,6 +239,29 @@ export interface IRunOptionsFormats {
|
|
|
239
239
|
*/
|
|
240
240
|
options: JsonObject;
|
|
241
241
|
}
|
|
242
|
+
/**
|
|
243
|
+
* Options relating to plugins - which ones to use and how they should behave
|
|
244
|
+
* @public
|
|
245
|
+
*/
|
|
246
|
+
export interface IRunOptionsPlugins {
|
|
247
|
+
/**
|
|
248
|
+
* Specifiers of plugins to load
|
|
249
|
+
* @example
|
|
250
|
+
* [
|
|
251
|
+
* "\@cucumber/my-plugin",
|
|
252
|
+
* "./custom-plugin.js"
|
|
253
|
+
* ]
|
|
254
|
+
* @remarks
|
|
255
|
+
* Each item is a module specifier for a plugin to be loaded.
|
|
256
|
+
*/
|
|
257
|
+
specifiers: string[];
|
|
258
|
+
/**
|
|
259
|
+
* Options to be provided to plugins
|
|
260
|
+
* @remarks
|
|
261
|
+
* The value must be a JSON-serializable object.
|
|
262
|
+
*/
|
|
263
|
+
options: JsonObject;
|
|
264
|
+
}
|
|
242
265
|
/**
|
|
243
266
|
* Structured configuration object suitable for passing to {@link runCucumber}
|
|
244
267
|
* @public
|
|
@@ -248,6 +271,7 @@ export interface IRunConfiguration {
|
|
|
248
271
|
support: Partial<ISupportCodeCoordinates>;
|
|
249
272
|
runtime: IRunOptionsRuntime;
|
|
250
273
|
formats: IRunOptionsFormats;
|
|
274
|
+
plugins?: IRunOptionsPlugins;
|
|
251
275
|
}
|
|
252
276
|
/**
|
|
253
277
|
* A collection of user-defined code and setup ("support code") that can be
|
|
@@ -283,6 +307,7 @@ export interface IRunOptions {
|
|
|
283
307
|
support: ISupportCodeCoordinatesOrLibrary;
|
|
284
308
|
runtime: IRunOptionsRuntime;
|
|
285
309
|
formats: IRunOptionsFormats;
|
|
310
|
+
plugins?: IRunOptionsPlugins;
|
|
286
311
|
}
|
|
287
312
|
/**
|
|
288
313
|
* Response from {@link runCucumber}
|
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 { 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 * Shard tests and execute only the selected shard, format `<index>/<total>`\n * @example 1/4\n * @remarks\n * Shards use 1-based numbering\n */\n shard?: string\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 * Specifiers of loaders to register, via `register()`\n */\n loaders: 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: Partial<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: Partial<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 | Partial<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 * 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
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import { 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 * Shard tests and execute only the selected shard, format `<index>/<total>`\n * @example 1/4\n * @remarks\n * Shards use 1-based numbering\n */\n shard?: string\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 * Specifiers of loaders to register, via `register()`\n */\n loaders: 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: Partial<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 * Options relating to plugins - which ones to use and how they should behave\n * @public\n */\nexport interface IRunOptionsPlugins {\n /**\n * Specifiers of plugins to load\n * @example\n * [\n * \"\\@cucumber/my-plugin\",\n * \"./custom-plugin.js\"\n * ]\n * @remarks\n * Each item is a module specifier for a plugin to be loaded.\n */\n specifiers: string[]\n /**\n * Options to be provided to plugins\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: Partial<ISupportCodeCoordinates>\n runtime: IRunOptionsRuntime\n formats: IRunOptionsFormats\n plugins?: IRunOptionsPlugins\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 | Partial<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 plugins?: IRunOptionsPlugins\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"]}
|
|
@@ -71,6 +71,8 @@ const ArgvParser = {
|
|
|
71
71
|
.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined`, `reverse` or `random`')
|
|
72
72
|
.option('-p, --profile <NAME>', 'specify the profile to use (repeatable)', ArgvParser.collect, [])
|
|
73
73
|
.option('--parallel <NUMBER_OF_WORKERS>', 'run in parallel with the given number of workers', (val) => ArgvParser.validateCountOption(val, '--parallel'))
|
|
74
|
+
.option('--plugin <SPECIFIER>', 'load a plugin (repeatable)', ArgvParser.collect)
|
|
75
|
+
.option('--plugin-options <JSON>', 'provide options for plugins (repeatable)', ArgvParser.mergeJson('--plugin-options'))
|
|
74
76
|
.option('--publish', 'Publish a report to https://reports.cucumber.io')
|
|
75
77
|
.option('-r, --require <GLOB|DIR|FILE>', 'require files before executing features (repeatable)', ArgvParser.collect)
|
|
76
78
|
.option('--require-module <NODE_MODULE>', 'require node modules before requiring files (repeatable)', ArgvParser.collect)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,wCAAoC;AACpC,kDAAoD;AAkBpD,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC7C,IAAI,GAAW,CAAA;YACf,IAAI,CAAC;gBACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,GAAU,KAAK,CAAA;gBACtB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAA;YACxE,CAAC;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,sCAAsC,GAAG,EAAE,CAAC,CAAA;YACvE,C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EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,CACxD;aACA,MAAM,CACL,iCAAiC,EACjC;wDACgD,EAChD,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CACL,uBAAuB,EACvB,wDAAwD,CACzD;aACA,MAAM,CAAC,UAAU,EAAE,iCAAiC,CAAC;aACrD,MAAM,CAAC,aAAa,EAAE,yCAAyC,CAAC;aAChE,MAAM,CACL,yBAAyB,EACzB,uFAAuF,EACvF,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CACL,2BAA2B,EAC3B,8EAA8E,EAC9E,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAC3C,CAAA;QAEH,OAAO,CAAC,WAAW,CACjB,UAAU,EACV,6FAA6F,CAC9F,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACnB,MAAM,EACJ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,GAAG,YAAY,EAChB,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport { version } from '../version'\nimport { documentation } from '../formatter/builtin'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .allowExcessArguments(true)\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Object.entries(documentation).reduce(\n (previous, [key, description]) =>\n previous + ` ${key}: ${description}\\n`,\n ''\n ),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '-l, --loader <NODE_MODULE>',\n 'module specifier(s) for loaders to be registered ahead of loading support code',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined`, `reverse` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option(\n '--shard <INDEX/TOTAL>',\n 'run shard INDEX of TOTAL shards. The index starts at 1'\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
1
|
+
{"version":3,"file":"argv_parser.js","sourceRoot":"","sources":["../../src/configuration/argv_parser.ts"],"names":[],"mappings":";;;;;AAAA,yCAAmC;AACnC,gEAAgC;AAChC,+CAA4C;AAC5C,wCAAoC;AACpC,kDAAoD;AAoBpD,MAAM,UAAU,GAAG;IACjB,OAAO,CAAI,GAAM,EAAE,OAAY,EAAE;QAC/B,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,SAAS,CAAC,MAAc;QACtB,OAAO,UAAU,GAAW,EAAE,OAAe,EAAE;YAC7C,IAAI,GAAW,CAAA;YACf,IAAI,CAAC;gBACH,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YACvB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,GAAU,KAAK,CAAA;gBACtB,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,yBAAyB,CAAC,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAA;YACxE,CAAC;YACD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClD,MAAM,IAAI,KAAK,CAAC,GAAG,MAAM,sCAAsC,GAAG,EAA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B,EAC/B,sDAAsD,EACtD,UAAU,CAAC,OAAO,CACnB;aACA,MAAM,CACL,gCAAgC,EAChC,0DAA0D,EAC1D,UAAU,CAAC,OAAO,CACnB;aACA,MAAM,CACL,6BAA6B,EAC7B,sEAAsE,EACtE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,EAAE,SAAS,CAAC,CACxD;aACA,MAAM,CACL,iCAAiC,EACjC;wDACgD,EAChD,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CACL,uBAAuB,EACvB,wDAAwD,CACzD;aACA,MAAM,CAAC,UAAU,EAAE,iCAAiC,CAAC;aACrD,MAAM,CAAC,aAAa,EAAE,yCAAyC,CAAC;aAChE,MAAM,CACL,yBAAyB,EACzB,uFAAuF,EACvF,UAAU,CAAC,SAAS,CACrB;aACA,MAAM,CACL,2BAA2B,EAC3B,8EAA8E,EAC9E,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAC3C,CAAA;QAEH,OAAO,CAAC,WAAW,CACjB,UAAU,EACV,6FAA6F,CAC9F,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACnB,MAAM,EACJ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,OAAO,EACP,GAAG,YAAY,EAChB,GAAoB,OAAO,CAAC,IAAI,EAAE,CAAA;QACnC,MAAM,aAAa,GAA4B,YAAY,CAAA;QAC3D,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5B,aAAa,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACpC,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP,MAAM;gBACN,YAAY;gBACZ,aAAa;gBACb,OAAO;aACR;YACD,aAAa;SACd,CAAA;IACH,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import { Command } from 'commander'\nimport merge from 'lodash.merge'\nimport { dialects } from '@cucumber/gherkin'\nimport { version } from '../version'\nimport { documentation } from '../formatter/builtin'\nimport { IConfiguration } from './types'\n\nexport interface IParsedArgvOptions {\n config?: string\n i18nKeywords?: string\n i18nLanguages?: boolean\n profile: string[]\n plugin?: string[]\n pluginOptions?: object\n}\n\nexport interface IParsedArgv {\n options: IParsedArgvOptions\n configuration: Partial<IConfiguration>\n}\n\ntype IRawArgvOptions = Partial<Omit<IConfiguration, 'paths'>> &\n IParsedArgvOptions\n\nconst ArgvParser = {\n collect<T>(val: T, memo: T[] = []): T[] {\n if (val) {\n return [...memo, val]\n }\n return undefined\n },\n\n mergeJson(option: string): (str: string, memo?: object) => object {\n return function (str: string, memo: object = {}) {\n let val: object\n try {\n val = JSON.parse(str)\n } catch (error) {\n const e: Error = error\n throw new Error(`${option} passed invalid JSON: ${e.message}: ${str}`)\n }\n if (typeof val !== 'object' || Array.isArray(val)) {\n throw new Error(`${option} must be passed JSON of an object: ${str}`)\n }\n return merge(memo, val)\n }\n },\n\n mergeTags(value: string, memo?: string): string {\n return memo ? `${memo} and (${value})` : `(${value})`\n },\n\n validateCountOption(value: string, optionName: string): number {\n const numericValue = parseInt(value)\n if (isNaN(numericValue) || numericValue < 0) {\n throw new Error(`${optionName} must be a non negative integer`)\n }\n return numericValue\n },\n\n validateLanguage(value: string): string {\n if (!Object.keys(dialects).includes(value)) {\n throw new Error(`Unsupported ISO 639-1: ${value}`)\n }\n return value\n },\n\n parse(argv: string[]): IParsedArgv {\n const program = new Command('cucumber-js')\n\n program\n .allowExcessArguments(true)\n .storeOptionsAsProperties(false)\n .usage('[options] [<GLOB|DIR|FILE[:LINE]>...]')\n .version(version, '-v, --version')\n .option('-b, --backtrace', 'show full backtrace for errors')\n .option('-c, --config <PATH>', 'specify configuration file')\n .option('-d, --dry-run', 'invoke formatters without executing steps')\n .option(\n '--exit, --force-exit',\n 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit'\n )\n .option('--fail-fast', 'abort the run on first failure')\n .option(\n '-f, --format <TYPE[:PATH]>',\n 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\\n' +\n Object.entries(documentation).reduce(\n (previous, [key, description]) =>\n previous + ` ${key}: ${description}\\n`,\n ''\n ),\n ArgvParser.collect\n )\n .option(\n '--format-options <JSON>',\n 'provide options for formatters (repeatable)',\n ArgvParser.mergeJson('--format-options')\n )\n .option(\n '--i18n-keywords <ISO 639-1>',\n 'list language keywords',\n ArgvParser.validateLanguage\n )\n .option('--i18n-languages', 'list languages')\n .option(\n '-i, --import <GLOB|DIR|FILE>',\n 'import files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '-l, --loader <NODE_MODULE>',\n 'module specifier(s) for loaders to be registered ahead of loading support code',\n ArgvParser.collect\n )\n .option(\n '--language <ISO 639-1>',\n 'provide the default language for feature files'\n )\n .option(\n '--name <REGEXP>',\n 'only execute the scenarios with name matching the expression (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--order <TYPE[:SEED]>',\n 'run scenarios in the specified order. Type should be `defined`, `reverse` or `random`'\n )\n .option(\n '-p, --profile <NAME>',\n 'specify the profile to use (repeatable)',\n ArgvParser.collect,\n []\n )\n .option(\n '--parallel <NUMBER_OF_WORKERS>',\n 'run in parallel with the given number of workers',\n (val) => ArgvParser.validateCountOption(val, '--parallel')\n )\n .option(\n '--plugin <SPECIFIER>',\n 'load a plugin (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--plugin-options <JSON>',\n 'provide options for plugins (repeatable)',\n ArgvParser.mergeJson('--plugin-options')\n )\n .option('--publish', 'Publish a report to https://reports.cucumber.io')\n .option(\n '-r, --require <GLOB|DIR|FILE>',\n 'require files before executing features (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--require-module <NODE_MODULE>',\n 'require node modules before requiring files (repeatable)',\n ArgvParser.collect\n )\n .option(\n '--retry <NUMBER_OF_RETRIES>',\n 'specify the number of times to retry failing test cases (default: 0)',\n (val) => ArgvParser.validateCountOption(val, '--retry')\n )\n .option(\n '--retry-tag-filter <EXPRESSION>',\n `only retries the features or scenarios with tags matching the expression (repeatable).\n This option requires '--retry' to be specified.`,\n ArgvParser.mergeTags\n )\n .option(\n '--shard <INDEX/TOTAL>',\n 'run shard INDEX of TOTAL shards. The index starts at 1'\n )\n .option('--strict', 'fail if there are pending steps')\n .option('--no-strict', 'succeed even if there are pending steps')\n .option(\n '-t, --tags <EXPRESSION>',\n 'only execute the features or scenarios with tags matching the expression (repeatable)',\n ArgvParser.mergeTags\n )\n .option(\n '--world-parameters <JSON>',\n 'provide parameters that will be passed to the world constructor (repeatable)',\n ArgvParser.mergeJson('--world-parameters')\n )\n\n program.addHelpText(\n 'afterAll',\n 'For more details please visit https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md'\n )\n\n program.parse(argv)\n const {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n ...regularStuff\n }: IRawArgvOptions = program.opts()\n const configuration: Partial<IConfiguration> = regularStuff\n if (program.args.length > 0) {\n configuration.paths = program.args\n }\n\n return {\n options: {\n config,\n i18nKeywords,\n i18nLanguages,\n profile,\n },\n configuration,\n }\n },\n}\n\nexport default ArgvParser\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n import: [],\n language: 'en',\n loader: [],\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n shard: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
|
|
1
|
+
{"version":3,"file":"default_configuration.js","sourceRoot":"","sources":["../../src/configuration/default_configuration.ts"],"names":[],"mappings":";;;AAEa,QAAA,qBAAqB,GAAmB;IACnD,SAAS,EAAE,KAAK;IAChB,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,KAAK;IACf,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,KAAK;IACd,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,EAAE;IACjB,KAAK,EAAE,CAAC;IACR,cAAc,EAAE,EAAE;IAClB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,IAAI;IACZ,IAAI,EAAE,EAAE;IACR,eAAe,EAAE,EAAE;CACpB,CAAA","sourcesContent":["import { IConfiguration } from './types'\n\nexport const DEFAULT_CONFIGURATION: IConfiguration = {\n backtrace: false,\n dryRun: false,\n forceExit: false,\n failFast: false,\n format: [],\n formatOptions: {},\n plugin: [],\n pluginOptions: {},\n import: [],\n language: 'en',\n loader: [],\n name: [],\n order: 'defined',\n paths: [],\n parallel: 0,\n publish: false,\n require: [],\n requireModule: [],\n retry: 0,\n retryTagFilter: '',\n shard: '',\n strict: true,\n tags: '',\n worldParameters: {},\n}\n"]}
|
|
@@ -62,6 +62,26 @@ export interface IConfiguration {
|
|
|
62
62
|
* The value must be a JSON-serializable object.
|
|
63
63
|
*/
|
|
64
64
|
formatOptions: JsonObject;
|
|
65
|
+
/**
|
|
66
|
+
* Name/path of each plugin to use
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* [
|
|
70
|
+
* "\@cucumber/my-plugin",
|
|
71
|
+
* "./custom-plugin.js"
|
|
72
|
+
* ]
|
|
73
|
+
* @default []
|
|
74
|
+
* @remarks
|
|
75
|
+
* Each item is a module specifier for a plugin to be loaded.
|
|
76
|
+
*/
|
|
77
|
+
plugin: string[];
|
|
78
|
+
/**
|
|
79
|
+
* Options to be provided to plugins
|
|
80
|
+
* @default \{\}
|
|
81
|
+
* @remarks
|
|
82
|
+
* The value must be a JSON-serializable object.
|
|
83
|
+
*/
|
|
84
|
+
pluginOptions: JsonObject;
|
|
65
85
|
/**
|
|
66
86
|
* Paths to where your support code is
|
|
67
87
|
* @default []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Module specifier(s) for loaders to be registered ahead of loading support code\n * @default []\n */\n loader: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Shard tests and execute only the selected shard, format `<index>/<total>`\n * @default \"\"\n */\n shard: string\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Collection of named configuration profiles\n * @public\n */\nexport type IProfiles = Record<string, Partial<IConfiguration>>\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { IPickleOrder } from '../filter'\n\n/**\n * User-defined configuration\n *\n * @public\n */\nexport interface IConfiguration {\n /**\n * Paths to where your feature files are\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-features}\n */\n paths: string[]\n /**\n * Show the full backtrace for errors\n * @default false\n */\n backtrace: boolean\n /**\n * Perform a dry run, where a test run is prepared but nothing is executed\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/dry_run.md}\n */\n dryRun: boolean\n /**\n * Explicitly call `process.exit()` after the test run\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/cli.md#exiting}\n * @remarks\n * This option is only used by the CLI.\n */\n forceExit: boolean\n /**\n * Stop running tests when a test fails\n * @default false\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/fail_fast.md}\n */\n failFast: boolean\n /**\n * Name/path and (optionally) output file path of each formatter to use\n *\n * @example\n * [\n * \"\\@cucumber/pretty-formatter\",\n * [\"html\", \"./reports/cucumber.html\"],\n * [\"./custom-formatter.js\", \"./reports/custom.txt\"]\n * ]\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md}\n * @remarks\n * Each item has one or two values. The first (required) identifies the\n * formatter to be used. The second (optional) specifies where the output\n * should be written.\n */\n format: Array<string | [string, string?]>\n /**\n * Options to be provided to formatters\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/formatters.md#options}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n formatOptions: JsonObject\n /**\n * Name/path of each plugin to use\n *\n * @example\n * [\n * \"\\@cucumber/my-plugin\",\n * \"./custom-plugin.js\"\n * ]\n * @default []\n * @remarks\n * Each item is a module specifier for a plugin to be loaded.\n */\n plugin: string[]\n /**\n * Options to be provided to plugins\n * @default \\{\\}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n pluginOptions: JsonObject\n /**\n * Paths to where your support code is\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n import: string[]\n /**\n * Default language for your feature files\n * @default \"en\"\n */\n language: string\n /**\n * Module specifier(s) for loaders to be registered ahead of loading support code\n * @default []\n */\n loader: string[]\n /**\n * Regular expressions of which scenario names should match one of to be run\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#names}\n */\n name: string[]\n /**\n * Run in the order defined, or in a random order\n * @default \"defined\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#order}\n */\n order: IPickleOrder\n /**\n * Run tests in parallel with the given number of worker processes\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/parallel.md}\n */\n parallel: number\n /**\n * Shard tests and execute only the selected shard, format `<index>/<total>`\n * @default \"\"\n */\n shard: string\n /**\n * Publish a report of your test run to https://reports.cucumber.io/\n * @default false\n */\n publish: boolean\n /**\n * Paths to where your support code is, for CommonJS\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code}\n */\n require: string[]\n /**\n * Names of transpilation modules to load, via `require()`\n * @default []\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/transpiling.md}\n */\n requireModule: string[]\n /**\n * Retry failing tests up to the given number of times\n * @default 0\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retry: number\n /**\n * Tag expression to filter which scenarios can be retried\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/retry.md}\n */\n retryTagFilter: string\n /**\n * Fail the test run if there are pending steps\n * @default true\n */\n strict: boolean\n /**\n * Tag expression to filter which scenarios should be run\n * @default \"\"\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/filtering.md#tags}\n */\n tags: string\n /**\n * Parameters to be passed to your World\n * @default \\{\\}\n * @see {@link https://github.com/cucumber/cucumber-js/blob/main/docs/support_files/world.md}\n * @remarks\n * The value must be a JSON-serializable object.\n */\n worldParameters: JsonObject\n}\n\n/**\n * Collection of named configuration profiles\n * @public\n */\nexport type IProfiles = Record<string, Partial<IConfiguration>>\n"]}
|
|
@@ -8,4 +8,5 @@ export declare class ConsoleLogger implements ILogger {
|
|
|
8
8
|
debug(message?: any, ...optionalParams: any[]): void;
|
|
9
9
|
error(message?: any, ...optionalParams: any[]): void;
|
|
10
10
|
warn(message?: any, ...optionalParams: any[]): void;
|
|
11
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
11
12
|
}
|
|
@@ -22,6 +22,9 @@ class ConsoleLogger {
|
|
|
22
22
|
warn(message, ...optionalParams) {
|
|
23
23
|
this.console.warn(message, ...optionalParams);
|
|
24
24
|
}
|
|
25
|
+
info(message, ...optionalParams) {
|
|
26
|
+
this.console.info(message, ...optionalParams);
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
exports.ConsoleLogger = ConsoleLogger;
|
|
27
30
|
//# sourceMappingURL=console_logger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console_logger.js","sourceRoot":"","sources":["../../src/environment/console_logger.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AAItC,MAAa,aAAa;IAId;IACA;IAJO,OAAO,CAAS;IAEjC,YACU,MAAgB,EAChB,YAAqB;QADrB,WAAM,GAAN,MAAM,CAAU;QAChB,iBAAY,GAAZ,YAAY,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAC/C,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"console_logger.js","sourceRoot":"","sources":["../../src/environment/console_logger.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AAItC,MAAa,aAAa;IAId;IACA;IAJO,OAAO,CAAS;IAEjC,YACU,MAAgB,EAChB,YAAqB;QADrB,WAAM,GAAN,MAAM,CAAU;QAChB,iBAAY,GAAZ,YAAY,CAAS;QAE7B,IAAI,CAAC,OAAO,GAAG,IAAI,sBAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;QAChD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC3C,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAC/C,CAAC;IAED,IAAI,CAAC,OAAa,EAAE,GAAG,cAAqB;QAC1C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,CAAA;IAC/C,CAAC;CACF;AA3BD,sCA2BC","sourcesContent":["import { Console } from 'node:console'\nimport { Writable } from 'node:stream'\nimport { ILogger } from './types'\n\nexport class ConsoleLogger implements ILogger {\n private readonly console: Console\n\n constructor(\n private stream: Writable,\n private debugEnabled: boolean\n ) {\n this.console = new Console(this.stream)\n }\n\n debug(message?: any, ...optionalParams: any[]): void {\n if (this.debugEnabled) {\n this.console.debug(message, ...optionalParams)\n }\n }\n\n error(message?: any, ...optionalParams: any[]): void {\n this.console.error(message, ...optionalParams)\n }\n\n warn(message?: any, ...optionalParams: any[]): void {\n this.console.warn(message, ...optionalParams)\n }\n\n info(message?: any, ...optionalParams: any[]): void {\n this.console.info(message, ...optionalParams)\n }\n}\n"]}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import { Writable } from 'node:stream';
|
|
2
|
+
/**
|
|
3
|
+
* A logger that can be used to direct messages to stderr or similar
|
|
4
|
+
* @public
|
|
5
|
+
* @remarks
|
|
6
|
+
* Matches the interface of Node.js Console, for the methods it has.
|
|
7
|
+
*/
|
|
2
8
|
export interface ILogger {
|
|
3
9
|
debug: (message?: any, ...optionalParams: any[]) => void;
|
|
4
10
|
error: (message?: any, ...optionalParams: any[]) => void;
|
|
5
11
|
warn: (message?: any, ...optionalParams: any[]) => void;
|
|
12
|
+
info: (message?: any, ...optionalParams: any[]) => void;
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
8
15
|
* Contextual data about the project environment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/environment/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\n\nexport interface ILogger {\n debug: (message?: any, ...optionalParams: any[]) => void\n error: (message?: any, ...optionalParams: any[]) => void\n warn: (message?: any, ...optionalParams: any[]) => void\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?: Record<string, string | undefined>\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\nexport type UsableEnvironment = Required<IRunEnvironment> & {\n logger: ILogger\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/environment/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\n\n/**\n * A logger that can be used to direct messages to stderr or similar\n * @public\n * @remarks\n * Matches the interface of Node.js Console, for the methods it has.\n */\nexport interface ILogger {\n debug: (message?: any, ...optionalParams: any[]) => void\n error: (message?: any, ...optionalParams: any[]) => void\n warn: (message?: any, ...optionalParams: any[]) => void\n info: (message?: any, ...optionalParams: any[]) => void\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?: Record<string, string | undefined>\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\nexport type UsableEnvironment = Required<IRunEnvironment> & {\n logger: ILogger\n}\n"]}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const filterPlugin: InternalPlugin<ISourcesCoordinates>;
|
|
1
|
+
import { Plugin } from '../plugin';
|
|
2
|
+
export declare const filterPlugin: Plugin;
|
|
@@ -8,12 +8,12 @@ const pickle_filter_1 = __importDefault(require("../pickle_filter"));
|
|
|
8
8
|
const helpers_1 = require("../cli/helpers");
|
|
9
9
|
exports.filterPlugin = {
|
|
10
10
|
type: 'plugin',
|
|
11
|
-
coordinator: async ({ on, options, logger, environment }) => {
|
|
11
|
+
coordinator: async ({ on, transform, options, logger, environment }) => {
|
|
12
12
|
let unexpandedSourcePaths = [];
|
|
13
13
|
on('paths:resolve', (paths) => {
|
|
14
14
|
unexpandedSourcePaths = paths.unexpandedSourcePaths;
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
transform('pickles:filter', async (allPickles) => {
|
|
17
17
|
const pickleFilter = new pickle_filter_1.default({
|
|
18
18
|
cwd: environment.cwd,
|
|
19
19
|
featurePaths: unexpandedSourcePaths,
|
|
@@ -22,7 +22,7 @@ exports.filterPlugin = {
|
|
|
22
22
|
});
|
|
23
23
|
return allPickles.filter((pickle) => pickleFilter.matches(pickle));
|
|
24
24
|
});
|
|
25
|
-
|
|
25
|
+
transform('pickles:order', async (unorderedPickles) => {
|
|
26
26
|
const orderedPickles = [...unorderedPickles];
|
|
27
27
|
(0, helpers_1.orderPickles)(orderedPickles, options.order, logger);
|
|
28
28
|
return orderedPickles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_plugin.js","sourceRoot":"","sources":["../../src/filter/filter_plugin.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"filter_plugin.js","sourceRoot":"","sources":["../../src/filter/filter_plugin.ts"],"names":[],"mappings":";;;;;;AACA,qEAA2C;AAC3C,4CAA6C;AAEhC,QAAA,YAAY,GAAW;IAClC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE;QACrE,IAAI,qBAAqB,GAAa,EAAE,CAAA;QACxC,EAAE,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,EAAE;YAC5B,qBAAqB,GAAG,KAAK,CAAC,qBAAqB,CAAA;QACrD,CAAC,CAAC,CAAA;QAEF,SAAS,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC/C,MAAM,YAAY,GAAG,IAAI,uBAAY,CAAC;gBACpC,GAAG,EAAE,WAAW,CAAC,GAAG;gBACpB,YAAY,EAAE,qBAAqB;gBACnC,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,aAAa,EAAE,OAAO,CAAC,aAAa;aACrC,CAAC,CAAA;YAEF,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;QACpE,CAAC,CAAC,CAAA;QAEF,SAAS,CAAC,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE;YACpD,MAAM,cAAc,GAAG,CAAC,GAAG,gBAAgB,CAAC,CAAA;YAC5C,IAAA,sBAAY,EAAC,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;YACnD,OAAO,cAAc,CAAA;QACvB,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { Plugin } from '../plugin'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from '../cli/helpers'\n\nexport const filterPlugin: Plugin = {\n type: 'plugin',\n coordinator: async ({ on, transform, options, logger, environment }) => {\n let unexpandedSourcePaths: string[] = []\n on('paths:resolve', (paths) => {\n unexpandedSourcePaths = paths.unexpandedSourcePaths\n })\n\n transform('pickles:filter', async (allPickles) => {\n const pickleFilter = new PickleFilter({\n cwd: environment.cwd,\n featurePaths: unexpandedSourcePaths,\n names: options.names,\n tagExpression: options.tagExpression,\n })\n\n return allPickles.filter((pickle) => pickleFilter.matches(pickle))\n })\n\n transform('pickles:order', async (unorderedPickles) => {\n const orderedPickles = [...unorderedPickles]\n orderPickles(orderedPickles, options.order, logger)\n return orderedPickles\n })\n },\n}\n"]}
|
package/lib/filter/types.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ import { GherkinDocument, Location, Pickle } from '@cucumber/messages';
|
|
|
8
8
|
* @example "random:234119"
|
|
9
9
|
*/
|
|
10
10
|
export type IPickleOrder = 'defined' | 'reverse' | 'random' | `random:${string}`;
|
|
11
|
+
/**
|
|
12
|
+
* A Pickle decorated with relevant context that can be filtered or sorted
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
11
15
|
export interface IFilterablePickle {
|
|
12
16
|
pickle: Pickle;
|
|
13
17
|
gherkinDocument: GherkinDocument;
|
package/lib/filter/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/filter/types.ts"],"names":[],"mappings":"","sourcesContent":["import { GherkinDocument, Location, Pickle } from '@cucumber/messages'\n\n/**\n * The ordering strategy for pickles\n * @public\n * @example \"defined\"\n * @example \"reverse\"\n * @example \"random\"\n * @example \"random:234119\"\n */\nexport type IPickleOrder = 'defined' | 'reverse' | 'random' | `random:${string}`\n\nexport interface IFilterablePickle {\n pickle: Pickle\n gherkinDocument: GherkinDocument\n location: Location\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/filter/types.ts"],"names":[],"mappings":"","sourcesContent":["import { GherkinDocument, Location, Pickle } from '@cucumber/messages'\n\n/**\n * The ordering strategy for pickles\n * @public\n * @example \"defined\"\n * @example \"reverse\"\n * @example \"random\"\n * @example \"random:234119\"\n */\nexport type IPickleOrder = 'defined' | 'reverse' | 'random' | `random:${string}`\n\n/**\n * A Pickle decorated with relevant context that can be filtered or sorted\n * @public\n */\nexport interface IFilterablePickle {\n pickle: Pickle\n gherkinDocument: GherkinDocument\n location: Location\n}\n"]}
|
|
@@ -112,7 +112,6 @@ class EventDataCollector {
|
|
|
112
112
|
}
|
|
113
113
|
storeAttachment(attachment) {
|
|
114
114
|
const { testCaseStartedId, testStepId } = attachment;
|
|
115
|
-
// TODO: we shouldn't have to check if these properties have values - they are non-nullable
|
|
116
115
|
if ((0, value_checker_1.doesHaveValue)(testCaseStartedId) && (0, value_checker_1.doesHaveValue)(testStepId)) {
|
|
117
116
|
const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
|
|
118
117
|
if ((0, value_checker_1.doesNotHaveValue)(stepAttachments[testStepId])) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,uDAAqE;AAsBrE,M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AC,CAAA;QACrD,CAAC;aAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAC,eAAyC;QACnE,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG;YAChD,OAAO,EAAE,eAAe,CAAC,OAAO;YAChC,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,eAAe,CAAC,UAAU;YACtC,eAAe,EAAE,EAAE;YACnB,WAAW,EAAE,EAAE;YACf,mBAAmB,EAAE;gBACnB,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;gBAClC,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO;aAC9C;SACF,CAAA;IACH,CAAC;IAED,eAAe,CAAC,UAA+B;QAC7C,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;QACpD,
|
|
1
|
+
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,uDAAqE;AAsBrE,MAAqB,kBAAkB;IAC7B,kBAAkB,GAA6C,EAAE,CAAA;IACjE,SAAS,GAAoC,EAAE,CAAA;IAC/C,WAAW,GAAsC,EAAE,CAAA;IACnD,sBAAsB,GAAyC,EAAE,CAAA;IAChE,uBAAuB,GAAsC,EAAE,CAAA;IAExE,YAAY,gBAA8B;QACxC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAA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CAAA;IAC9E,CAAC;CACF;AA3GD,qCA2GC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({\n testCaseStartedId,\n willBeRetried,\n }: messages.TestCaseFinished): void {\n const stepResults = Object.values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried\n }\n}\n"]}
|