@cucumber/cucumber 10.5.1 → 10.7.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/lib/api/convert_configuration.js +1 -0
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +3 -1
- package/lib/api/formatters.js +36 -45
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/load_support.js +9 -2
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/plugins.js +3 -3
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +10 -6
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +1 -4
- package/lib/api/runtime.js +1 -4
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.d.ts +2 -1
- package/lib/api/support.js +7 -1
- package/lib/api/support.js.map +1 -1
- package/lib/api/types.d.ts +7 -3
- package/lib/api/types.js.map +1 -1
- package/lib/configuration/argv_parser.js +3 -2
- package/lib/configuration/argv_parser.js.map +1 -1
- package/lib/configuration/default_configuration.js +1 -0
- package/lib/configuration/default_configuration.js.map +1 -1
- package/lib/configuration/merge_configurations.js +1 -0
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/types.d.ts +5 -0
- package/lib/configuration/types.js.map +1 -1
- package/lib/configuration/validate_configuration.js +3 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/formatter/builder.d.ts +1 -1
- package/lib/formatter/builder.js +6 -13
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/builtin/html.d.ts +6 -0
- package/lib/formatter/builtin/html.js +25 -0
- package/lib/formatter/builtin/html.js.map +1 -0
- package/lib/formatter/builtin/index.d.ts +3 -0
- package/lib/formatter/builtin/index.js +33 -0
- package/lib/formatter/builtin/index.js.map +1 -0
- package/lib/formatter/builtin/message.d.ts +6 -0
- package/lib/formatter/builtin/message.js +10 -0
- package/lib/formatter/builtin/message.js.map +1 -0
- package/lib/formatter/create_stream.d.ts +4 -0
- package/lib/formatter/create_stream.js +28 -0
- package/lib/formatter/create_stream.js.map +1 -0
- package/lib/formatter/find_class_or_plugin.d.ts +1 -0
- package/lib/formatter/find_class_or_plugin.js +25 -0
- package/lib/formatter/find_class_or_plugin.js.map +1 -0
- package/lib/formatter/helpers/formatters.d.ts +0 -1
- package/lib/formatter/helpers/formatters.js +0 -12
- package/lib/formatter/helpers/formatters.js.map +1 -1
- package/lib/formatter/import_code.d.ts +1 -0
- package/lib/formatter/import_code.js +27 -0
- package/lib/formatter/import_code.js.map +1 -0
- package/lib/formatter/index.d.ts +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/resolve_implementation.d.ts +2 -0
- package/lib/formatter/resolve_implementation.js +24 -0
- package/lib/formatter/resolve_implementation.js.map +1 -0
- package/lib/paths/paths.js +1 -0
- package/lib/paths/paths.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +3 -2
- package/lib/plugin/plugin_manager.js +12 -2
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +11 -0
- package/lib/plugin/types.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +4 -5
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +2 -8
- package/lib/runtime/parallel/coordinator.js +10 -42
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/worker.d.ts +1 -1
- package/lib/runtime/parallel/worker.js +12 -15
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +3 -1
- package/lib/runtime/test_case_runner.js +6 -1
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/support_code_library_builder/index.js +1 -0
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/types.d.ts +1 -0
- package/lib/support_code_library_builder/types.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 +3 -2
- package/lib/formatter/html_formatter.d.ts +0 -7
- package/lib/formatter/html_formatter.js +0 -31
- package/lib/formatter/html_formatter.js.map +0 -1
- package/lib/formatter/message_formatter.d.ts +0 -5
- package/lib/formatter/message_formatter.js +0 -15
- package/lib/formatter/message_formatter.js.map +0 -1
|
@@ -15,6 +15,7 @@ async function convertConfiguration(logger, flatConfiguration, env) {
|
|
|
15
15
|
requireModules: flatConfiguration.requireModule,
|
|
16
16
|
requirePaths: flatConfiguration.require,
|
|
17
17
|
importPaths: flatConfiguration.import,
|
|
18
|
+
loaders: flatConfiguration.loader,
|
|
18
19
|
},
|
|
19
20
|
runtime: {
|
|
20
21
|
dryRun: flatConfiguration.dryRun,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;YAC9B,cAAc,EAAE,iBAAiB,CAAC,QAAQ;YAC1C,KAAK,EAAE,iBAAiB,CAAC,IAAI;YAC7B,aAAa,EAAE,iBAAiB,CAAC,IAAI;YACrC,KAAK,EAAE,iBAAiB,CAAC,KAAK;SAC/B;QACD,OAAO,EAAE;YACP,cAAc,EAAE,iBAAiB,CAAC,aAAa;YAC/C,YAAY,EAAE,iBAAiB,CAAC,OAAO;YACvC,WAAW,EAAE,iBAAiB,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"convert_configuration.js","sourceRoot":"","sources":["../../src/api/convert_configuration.ts"],"names":[],"mappings":";;;AAAA,oDAIyB;AAKlB,KAAK,UAAU,oBAAoB,CACxC,MAAe,EACf,iBAAiC,EACjC,GAAsB;IAEtB,OAAO;QACL,OAAO,EAAE;YACP,KAAK,EAAE,iBAAiB,CAAC,KAAK;Y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AAE,CAAC,CAAC,CAAC;YAC9D,UAAU;QACZ,KAAK,EAAE,YAAY;aAChB,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;aAChC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,EAAE;YACjC,OAAO;gBACL,GAAG,MAAM;gBACT,CAAC,MAAM,CAAC,EAAE,IAAI;aACf,CAAA;QACH,CAAC,EAAE,EAAE,CAAC;QACR,OAAO,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,GAAG,CAAC;QAClD,OAAO,EAAE,iBAAiB,CAAC,aAAa;KACzC,CAAA;AACH,CAAC;AAED,SAAS,iBAAiB,CACxB,iBAAiC,EACjC,GAAsB;IAEtB,MAAM,OAAO,GAAG,YAAY,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAA;IACpD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,KAAK,CAAA;KACb;IACD,OAAO;QACL,GAAG,EAAE,GAAG,CAAC,oBAAoB;QAC7B,KAAK,EAAE,GAAG,CAAC,sBAAsB;KAClC,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CACnB,iBAAiC,EACjC,GAAsB;IAEtB,OAAO,CACL,iBAAiB,CAAC,OAAO;QACzB,IAAA,8BAAc,EAAC,GAAG,CAAC,wBAAwB,CAAC;QAC5C,GAAG,CAAC,sBAAsB,KAAK,SAAS,CACzC,CAAA;AACH,CAAC","sourcesContent":["import {\n IConfiguration,\n isTruthyString,\n splitFormatDescriptor,\n} from '../configuration'\nimport { IPublishConfig } from '../publish'\nimport { ILogger } from '../logger'\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 },\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 }\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/formatters.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import { IFormatterStream } from '../formatter';
|
|
|
5
5
|
import { EventDataCollector } from '../formatter/helpers';
|
|
6
6
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
7
|
import { ILogger } from '../logger';
|
|
8
|
+
import { PluginManager } from '../plugin';
|
|
8
9
|
import { IRunOptionsFormats } from './types';
|
|
9
|
-
export declare function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, }: {
|
|
10
|
+
export declare function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, pluginManager, }: {
|
|
10
11
|
env: NodeJS.ProcessEnv;
|
|
11
12
|
cwd: string;
|
|
12
13
|
stdout: IFormatterStream;
|
|
@@ -17,4 +18,5 @@ export declare function initializeFormatters({ env, cwd, stdout, logger, onStrea
|
|
|
17
18
|
eventDataCollector: EventDataCollector;
|
|
18
19
|
configuration: IRunOptionsFormats;
|
|
19
20
|
supportCodeLibrary: SupportCodeLibrary;
|
|
21
|
+
pluginManager: PluginManager;
|
|
20
22
|
}): Promise<() => Promise<void>>;
|
package/lib/api/formatters.js
CHANGED
|
@@ -5,56 +5,47 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.initializeFormatters = void 0;
|
|
7
7
|
const node_util_1 = require("node:util");
|
|
8
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
-
const fs_1 = __importDefault(require("mz/fs"));
|
|
10
|
-
const mkdirp_1 = require("mkdirp");
|
|
11
8
|
const builder_1 = __importDefault(require("../formatter/builder"));
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const typeOptions = {
|
|
19
|
-
env,
|
|
20
|
-
cwd,
|
|
21
|
-
eventBroadcaster,
|
|
22
|
-
eventDataCollector,
|
|
23
|
-
log: stream.write.bind(stream),
|
|
24
|
-
parsedArgvOptions: configuration.options,
|
|
25
|
-
stream,
|
|
26
|
-
cleanup: stream === stdout
|
|
27
|
-
? async () => await Promise.resolve()
|
|
28
|
-
: (0, node_util_1.promisify)(stream.end.bind(stream)),
|
|
29
|
-
supportCodeLibrary,
|
|
30
|
-
};
|
|
31
|
-
if (type === 'progress-bar' && !stream.isTTY) {
|
|
9
|
+
const create_stream_1 = require("../formatter/create_stream");
|
|
10
|
+
const resolve_implementation_1 = require("../formatter/resolve_implementation");
|
|
11
|
+
async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, pluginManager, }) {
|
|
12
|
+
const cleanupFns = [];
|
|
13
|
+
async function initializeFormatter(stream, target, specifier) {
|
|
14
|
+
if (specifier === 'progress-bar' && !stream.isTTY) {
|
|
32
15
|
logger.warn(`Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`);
|
|
33
|
-
|
|
16
|
+
specifier = 'progress';
|
|
34
17
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
18
|
+
const implementation = await (0, resolve_implementation_1.resolveImplementation)(specifier, cwd);
|
|
19
|
+
if (typeof implementation === 'function') {
|
|
20
|
+
const typeOptions = {
|
|
21
|
+
env,
|
|
22
|
+
cwd,
|
|
23
|
+
eventBroadcaster,
|
|
24
|
+
eventDataCollector,
|
|
25
|
+
log: stream.write.bind(stream),
|
|
26
|
+
parsedArgvOptions: configuration.options,
|
|
27
|
+
stream,
|
|
28
|
+
cleanup: stream === stdout
|
|
29
|
+
? async () => await Promise.resolve()
|
|
30
|
+
: (0, node_util_1.promisify)(stream.end.bind(stream)),
|
|
31
|
+
supportCodeLibrary,
|
|
32
|
+
};
|
|
33
|
+
const formatter = await builder_1.default.build(implementation, typeOptions);
|
|
34
|
+
cleanupFns.push(async () => formatter.finished());
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
await pluginManager.initFormatter(implementation, configuration.options, stream.write.bind(stream));
|
|
38
|
+
if (stream !== stdout) {
|
|
39
|
+
cleanupFns.push((0, node_util_1.promisify)(stream.end.bind(stream)));
|
|
48
40
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
await Promise.all(streamPromises);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
await initializeFormatter(stdout, 'stdout', configuration.stdout);
|
|
44
|
+
for (const [target, specifier] of Object.entries(configuration.files)) {
|
|
45
|
+
await initializeFormatter(await (0, create_stream_1.createStream)(target, onStreamError, cwd, logger), target, specifier);
|
|
46
|
+
}
|
|
56
47
|
return async function () {
|
|
57
|
-
await Promise.all(
|
|
48
|
+
await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()));
|
|
58
49
|
};
|
|
59
50
|
}
|
|
60
51
|
exports.initializeFormatters = initializeFormatters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAKrC,mEAAmD;AAEnD,8DAAyD;AACzD,gFAA2E;AAIpE,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,EAClB,aAAa,GAad;IACC,MAAM,UAAU,GAA+B,EAAE,CAAA;IAEjD,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,MAAc,EACd,SAAiB;QAEjB,IAAI,SAAS,KAAK,cAAc,IAAI,CAAE,MAAyB,CAAC,KAAK,EAAE;YACrE,MAA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CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACrE,MAAM,mBAAmB,CACvB,MAAM,IAAA,4BAAY,EAAC,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,CAAC,EACtD,MAAM,EACN,SAAS,CACV,CAAA;KACF;IAED,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC,CAAA;AACH,CAAC;AAlFD,oDAkFC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../logger'\nimport { createStream } from '../formatter/create_stream'\nimport { resolveImplementation } from '../formatter/resolve_implementation'\nimport { PluginManager } from '../plugin'\nimport { IRunOptionsFormats } from './types'\n\nexport async function initializeFormatters({\n env,\n cwd,\n stdout,\n logger,\n onStreamError,\n eventBroadcaster,\n eventDataCollector,\n configuration,\n supportCodeLibrary,\n pluginManager,\n}: {\n env: NodeJS.ProcessEnv\n cwd: string\n stdout: IFormatterStream\n stderr: IFormatterStream\n logger: ILogger\n onStreamError: () => void\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n configuration: IRunOptionsFormats\n supportCodeLibrary: SupportCodeLibrary\n pluginManager: PluginManager\n}): Promise<() => Promise<void>> {\n const cleanupFns: Array<() => Promise<void>> = []\n\n async function initializeFormatter(\n stream: IFormatterStream,\n target: string,\n specifier: string\n ): Promise<void> {\n if (specifier === 'progress-bar' && !(stream as TtyWriteStream).isTTY) {\n logger.warn(\n `Cannot use 'progress-bar' formatter for output to '${target}' as not a TTY. Switching to 'progress' formatter.`\n )\n specifier = 'progress'\n }\n const implementation = await resolveImplementation(specifier, cwd)\n if (typeof implementation === 'function') {\n const typeOptions = {\n env,\n cwd,\n eventBroadcaster,\n eventDataCollector,\n log: stream.write.bind(stream),\n parsedArgvOptions: configuration.options,\n stream,\n cleanup:\n stream === stdout\n ? async () => await Promise.resolve()\n : promisify<any>(stream.end.bind(stream)),\n supportCodeLibrary,\n }\n const formatter = await FormatterBuilder.build(\n implementation,\n typeOptions\n )\n cleanupFns.push(async () => formatter.finished())\n } else {\n await pluginManager.initFormatter(\n implementation,\n configuration.options,\n stream.write.bind(stream)\n )\n if (stream !== stdout) {\n cleanupFns.push(promisify<any>(stream.end.bind(stream)))\n }\n }\n }\n\n await initializeFormatter(stdout, 'stdout', configuration.stdout)\n for (const [target, specifier] of Object.entries(configuration.files)) {\n await initializeFormatter(\n await createStream(target, onStreamError, cwd, logger),\n target,\n specifier\n )\n }\n\n return async function () {\n await Promise.all(cleanupFns.map((cleanupFn) => cleanupFn()))\n }\n}\n"]}
|
package/lib/api/load_support.js
CHANGED
|
@@ -17,16 +17,23 @@ async function loadSupport(options, environment = {}) {
|
|
|
17
17
|
const mergedEnvironment = (0, environment_1.mergeEnvironment)(environment);
|
|
18
18
|
const { cwd, logger } = mergedEnvironment;
|
|
19
19
|
const newId = messages_1.IdGenerator.uuid();
|
|
20
|
+
const supportCoordinates = Object.assign({
|
|
21
|
+
requireModules: [],
|
|
22
|
+
requirePaths: [],
|
|
23
|
+
loaders: [],
|
|
24
|
+
importPaths: [],
|
|
25
|
+
}, options.support);
|
|
20
26
|
const pluginManager = await (0, plugins_1.initializeForLoadSupport)();
|
|
21
|
-
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources,
|
|
27
|
+
const resolvedPaths = await (0, paths_1.resolvePaths)(logger, cwd, options.sources, supportCoordinates);
|
|
22
28
|
pluginManager.emit('paths:resolve', resolvedPaths);
|
|
23
29
|
const { requirePaths, importPaths } = resolvedPaths;
|
|
24
30
|
const supportCodeLibrary = await (0, support_1.getSupportCodeLibrary)({
|
|
25
31
|
logger,
|
|
26
32
|
cwd,
|
|
27
33
|
newId,
|
|
28
|
-
requireModules:
|
|
34
|
+
requireModules: supportCoordinates.requireModules,
|
|
29
35
|
requirePaths,
|
|
36
|
+
loaders: supportCoordinates.loaders,
|
|
30
37
|
importPaths,
|
|
31
38
|
});
|
|
32
39
|
await pluginManager.cleanup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAMvC,uCAAiD;AACjD,+CAAgD;AAChD,uCAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,GAAE,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,
|
|
1
|
+
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAChD,oCAAuC;AAMvC,uCAAiD;AACjD,+CAAgD;AAChD,uCAAoD;AAEpD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAAA;IACzC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CACtC;QACE,cAAc,EAAE,EAAE;QAClB,YAAY,EAAE,EAAE;QAChB,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,EAAE;KAChB,EACD,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,MAAM,aAAa,GAAG,MAAM,IAAA,kCAAwB,GAAE,CAAA;IACtD,MAAM,aAAa,GAAG,MAAM,IAAA,oBAAY,EACtC,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,kBAAkB,CACnB,CAAA;IACD,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAA;IAClD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,aAAa,CAAA;IACnD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAqB,EAAC;QACrD,MAAM;QACN,GAAG;QACH,KAAK;QACL,cAAc,EAAE,kBAAkB,CAAC,cAAc;QACjD,YAAY;QACZ,OAAO,EAAE,kBAAkB,CAAC,OAAO;QACnC,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,OAAO,kBAAkB,CAAA;AAC3B,CAAC;AApCD,kCAoCC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { resolvePaths } from '../paths'\nimport {\n ILoadSupportOptions,\n IRunEnvironment,\n ISupportCodeLibrary,\n} from './types'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { initializeForLoadSupport } from './plugins'\n\n/**\n * Load support code for use in test runs\n *\n * @public\n * @param options - Options required to find the support code\n * @param environment - Project environment\n */\nexport async function loadSupport(\n options: ILoadSupportOptions,\n environment: IRunEnvironment = {}\n): Promise<ISupportCodeLibrary> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, logger } = mergedEnvironment\n const newId = IdGenerator.uuid()\n const supportCoordinates = Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n const pluginManager = await initializeForLoadSupport()\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { requirePaths, importPaths } = resolvedPaths\n const supportCodeLibrary = await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules: supportCoordinates.requireModules,\n requirePaths,\n loaders: supportCoordinates.loaders,\n importPaths,\n })\n await pluginManager.cleanup()\n return supportCodeLibrary\n}\n"]}
|
package/lib/api/plugins.js
CHANGED
|
@@ -10,7 +10,7 @@ const filter_1 = __importDefault(require("../filter"));
|
|
|
10
10
|
async function initializeForLoadSources(logger, coordinates, environment) {
|
|
11
11
|
// eventually we'll load plugin packages here
|
|
12
12
|
const pluginManager = new plugin_1.PluginManager();
|
|
13
|
-
await pluginManager.
|
|
13
|
+
await pluginManager.initCoordinator('loadSources', filter_1.default, coordinates, logger, environment);
|
|
14
14
|
return pluginManager;
|
|
15
15
|
}
|
|
16
16
|
exports.initializeForLoadSources = initializeForLoadSources;
|
|
@@ -22,8 +22,8 @@ exports.initializeForLoadSupport = initializeForLoadSupport;
|
|
|
22
22
|
async function initializeForRunCucumber(logger, configuration, environment) {
|
|
23
23
|
// eventually we'll load plugin packages here
|
|
24
24
|
const pluginManager = new plugin_1.PluginManager();
|
|
25
|
-
await pluginManager.
|
|
26
|
-
await pluginManager.
|
|
25
|
+
await pluginManager.initCoordinator('runCucumber', publish_1.default, configuration.formats.publish, logger, environment);
|
|
26
|
+
await pluginManager.initCoordinator('runCucumber', filter_1.default, configuration.sources, logger, environment);
|
|
27
27
|
return pluginManager;
|
|
28
28
|
}
|
|
29
29
|
exports.initializeForRunCucumber = initializeForRunCucumber;
|
package/lib/api/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAyC;AACzC,yDAAsC;AAEtC,uDAAoC;AAO7B,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,WAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAyC;AACzC,yDAAsC;AAEtC,uDAAoC;AAO7B,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,WAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,WAAW,EACX,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAfD,4DAeC;AAEM,KAAK,UAAU,wBAAwB;IAC5C,6CAA6C;IAC7C,OAAO,IAAI,sBAAa,EAAE,CAAA;AAC5B,CAAC;AAHD,4DAGC;AAEM,KAAK,UAAU,wBAAwB,CAC5C,MAAe,EACf,aAAgC,EAChC,WAAsC;IAEtC,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,EAAE,CAAA;IACzC,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,iBAAa,EACb,aAAa,CAAC,OAAO,CAAC,OAAO,EAC7B,MAAM,EACN,WAAW,CACZ,CAAA;IACD,MAAM,aAAa,CAAC,eAAe,CACjC,aAAa,EACb,gBAAY,EACZ,aAAa,CAAC,OAAO,EACrB,MAAM,EACN,WAAW,CACZ,CAAA;IACD,OAAO,aAAa,CAAA;AACtB,CAAC;AAtBD,4DAsBC","sourcesContent":["import { PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport { ILogger } from '../logger'\nimport filterPlugin from '../filter'\nimport {\n IRunConfiguration,\n IRunEnvironment,\n ISourcesCoordinates,\n} from './types'\n\nexport async function initializeForLoadSources(\n logger: ILogger,\n coordinates: ISourcesCoordinates,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.initCoordinator(\n 'loadSources',\n filterPlugin,\n coordinates,\n logger,\n environment\n )\n return pluginManager\n}\n\nexport async function initializeForLoadSupport(): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n return new PluginManager()\n}\n\nexport async function initializeForRunCucumber(\n logger: ILogger,\n configuration: IRunConfiguration,\n environment: Required<IRunEnvironment>\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager()\n await pluginManager.initCoordinator(\n 'runCucumber',\n publishPlugin,\n configuration.formats.publish,\n logger,\n environment\n )\n await pluginManager.initCoordinator(\n 'runCucumber',\n filterPlugin,\n configuration.sources,\n logger,\n environment\n )\n return pluginManager\n}\n"]}
|
package/lib/api/run_cucumber.js
CHANGED
|
@@ -26,7 +26,12 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
26
26
|
const newId = messages_1.IdGenerator.uuid();
|
|
27
27
|
const supportCoordinates = 'originalCoordinates' in options.support
|
|
28
28
|
? options.support.originalCoordinates
|
|
29
|
-
:
|
|
29
|
+
: Object.assign({
|
|
30
|
+
requireModules: [],
|
|
31
|
+
requirePaths: [],
|
|
32
|
+
loaders: [],
|
|
33
|
+
importPaths: [],
|
|
34
|
+
}, options.support);
|
|
30
35
|
const pluginManager = await (0, plugins_1.initializeForRunCucumber)(logger, {
|
|
31
36
|
...options,
|
|
32
37
|
support: supportCoordinates,
|
|
@@ -41,8 +46,9 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
41
46
|
cwd,
|
|
42
47
|
newId,
|
|
43
48
|
requirePaths,
|
|
44
|
-
importPaths,
|
|
45
49
|
requireModules: supportCoordinates.requireModules,
|
|
50
|
+
importPaths,
|
|
51
|
+
loaders: supportCoordinates.loaders,
|
|
46
52
|
});
|
|
47
53
|
const eventBroadcaster = new node_events_1.EventEmitter();
|
|
48
54
|
if (onMessage) {
|
|
@@ -62,6 +68,7 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
62
68
|
eventDataCollector,
|
|
63
69
|
configuration: options.formats,
|
|
64
70
|
supportCodeLibrary,
|
|
71
|
+
pluginManager,
|
|
65
72
|
});
|
|
66
73
|
await (0, helpers_2.emitMetaMessage)(eventBroadcaster, env);
|
|
67
74
|
let pickleIds = [];
|
|
@@ -103,14 +110,11 @@ async function runCucumber(options, environment = {}, onMessage) {
|
|
|
103
110
|
pickleIds,
|
|
104
111
|
newId,
|
|
105
112
|
supportCodeLibrary,
|
|
106
|
-
requireModules: supportCoordinates.requireModules,
|
|
107
|
-
requirePaths,
|
|
108
|
-
importPaths,
|
|
109
113
|
options: options.runtime,
|
|
110
114
|
});
|
|
111
115
|
const success = await runtime.start();
|
|
112
|
-
await cleanupFormatters();
|
|
113
116
|
await pluginManager.cleanup();
|
|
117
|
+
await cleanupFormatters();
|
|
114
118
|
return {
|
|
115
119
|
success: success && !formatterStreamError,
|
|
116
120
|
support: supportCodeLibrary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;AACzE,oCAAuC;AAGvC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,+CAAgD;AAChD,uCAA+C;AAC/C,uCAAoD;AAEpD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,OAAoB,EACpB,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,iBAAiB,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACvD,MAAM,EAAE,G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CAAC,CAAA;IAEF,MAAM,OAAO,GAAG,IAAA,qBAAW,EAAC;QAC1B,GAAG;QACH,MAAM;QACN,gBAAgB;QAChB,kBAAkB;QAClB,SAAS;QACT,KAAK;QACL,kBAAkB;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;IACF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;IACrC,MAAM,aAAa,CAAC,OAAO,EAAE,CAAA;IAC7B,MAAM,iBAAiB,EAAE,CAAA;IAEzB,OAAO;QACL,OAAO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AA1ID,kCA0IC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { resolvePaths } from '../paths'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { getPicklesAndErrors } from './gherkin'\nimport { initializeForRunCucumber } from './plugins'\n\n/**\n * Execute a Cucumber test run and return the overall result\n *\n * @public\n * @param options - Options for the run, obtainable via {@link loadConfiguration}\n * @param environment - Project environment\n * @param onMessage - Callback fired each time Cucumber emits a message\n */\nexport async function runCucumber(\n options: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const mergedEnvironment = mergeEnvironment(environment)\n const { cwd, stdout, stderr, env, logger } = mergedEnvironment\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'originalCoordinates' in options.support\n ? options.support.originalCoordinates\n : Object.assign(\n {\n requireModules: [],\n requirePaths: [],\n loaders: [],\n importPaths: [],\n },\n options.support\n )\n\n const pluginManager = await initializeForRunCucumber(\n logger,\n {\n ...options,\n support: supportCoordinates,\n },\n mergedEnvironment\n )\n\n const resolvedPaths = await resolvePaths(\n logger,\n cwd,\n options.sources,\n supportCoordinates\n )\n pluginManager.emit('paths:resolve', resolvedPaths)\n const { sourcePaths, requirePaths, importPaths } = resolvedPaths\n\n const supportCodeLibrary =\n 'originalCoordinates' in options.support\n ? (options.support as SupportCodeLibrary)\n : await getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requirePaths,\n requireModules: supportCoordinates.requireModules,\n importPaths,\n loaders: supportCoordinates.loaders,\n })\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) =>\n pluginManager.emit('message', value)\n )\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanupFormatters = await initializeFormatters({\n env,\n cwd,\n stdout,\n stderr,\n logger,\n onStreamError: () => (formatterStreamError = true),\n eventBroadcaster,\n eventDataCollector,\n configuration: options.formats,\n supportCodeLibrary,\n pluginManager,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let pickleIds: string[] = []\n let parseErrors: ParseError[] = []\n if (sourcePaths.length > 0) {\n const gherkinResult = await getPicklesAndErrors({\n newId,\n cwd,\n sourcePaths,\n coordinates: options.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n const filteredPickles = await pluginManager.transform(\n 'pickles:filter',\n gherkinResult.filterablePickles\n )\n const orderedPickles = await pluginManager.transform(\n 'pickles:order',\n filteredPickles\n )\n pickleIds = orderedPickles.map(({ pickle }) => pickle.id)\n parseErrors = gherkinResult.parseErrors\n }\n if (parseErrors.length) {\n parseErrors.forEach((parseError) => {\n logger.error(\n `Parse error in \"${parseError.source.uri}\" ${parseError.message}`\n )\n })\n await cleanupFormatters()\n await pluginManager.cleanup()\n return {\n success: false,\n support: supportCodeLibrary,\n }\n }\n\n emitSupportCodeMessages({\n eventBroadcaster,\n supportCodeLibrary,\n newId,\n })\n\n const runtime = makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n options: options.runtime,\n })\n const success = await runtime.start()\n await pluginManager.cleanup()\n await cleanupFormatters()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
|
package/lib/api/runtime.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { EventDataCollector } from '../formatter/helpers';
|
|
|
6
6
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
7
|
import { ILogger } from '../logger';
|
|
8
8
|
import { IRunOptionsRuntime } from './types';
|
|
9
|
-
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary,
|
|
9
|
+
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }: {
|
|
10
10
|
cwd: string;
|
|
11
11
|
logger: ILogger;
|
|
12
12
|
eventBroadcaster: EventEmitter;
|
|
@@ -14,8 +14,5 @@ export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCo
|
|
|
14
14
|
newId: IdGenerator.NewId;
|
|
15
15
|
pickleIds: string[];
|
|
16
16
|
supportCodeLibrary: SupportCodeLibrary;
|
|
17
|
-
requireModules: string[];
|
|
18
|
-
requirePaths: string[];
|
|
19
|
-
importPaths: string[];
|
|
20
17
|
options: IRunOptionsRuntime;
|
|
21
18
|
}): IRuntime;
|
package/lib/api/runtime.js
CHANGED
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.makeRuntime = void 0;
|
|
7
7
|
const runtime_1 = __importDefault(require("../runtime"));
|
|
8
8
|
const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
|
|
9
|
-
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary,
|
|
9
|
+
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, options: { parallel, ...options }, }) {
|
|
10
10
|
if (parallel > 0) {
|
|
11
11
|
return new coordinator_1.default({
|
|
12
12
|
cwd,
|
|
@@ -17,9 +17,6 @@ function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickle
|
|
|
17
17
|
options,
|
|
18
18
|
newId,
|
|
19
19
|
supportCodeLibrary,
|
|
20
|
-
requireModules,
|
|
21
|
-
requirePaths,
|
|
22
|
-
importPaths,
|
|
23
20
|
numberOfWorkers: parallel,
|
|
24
21
|
});
|
|
25
22
|
}
|
package/lib/api/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAEA,yDAA8C;AAG9C,kFAAyD;AAIzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAEA,yDAA8C;AAG9C,kFAAyD;AAIzD,SAAgB,WAAW,CAAC,EAC1B,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,KAAK,EACL,kBAAkB,EAClB,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAUlC;IACC,IAAI,QAAQ,GAAG,CAAC,EAAE;QAChB,OAAO,IAAI,qBAAW,CAAC;YACrB,GAAG;YACH,MAAM;YACN,gBAAgB;YAChB,kBAAkB;YAClB,SAAS;YACT,OAAO;YACP,KAAK;YACL,kBAAkB;YAClB,eAAe,EAAE,QAAQ;SAC1B,CAAC,CAAA;KACH;IACD,OAAO,IAAI,iBAAO,CAAC;QACjB,gBAAgB;QAChB,kBAAkB;QAClB,KAAK;QACL,SAAS;QACT,kBAAkB;QAClB,OAAO;KACR,CAAC,CAAA;AACJ,CAAC;AAxCD,kCAwCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport Runtime, { IRuntime } from '../runtime'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport Coordinator from '../runtime/parallel/coordinator'\nimport { ILogger } from '../logger'\nimport { IRunOptionsRuntime } from './types'\n\nexport function makeRuntime({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n newId,\n supportCodeLibrary,\n options: { parallel, ...options },\n}: {\n cwd: string\n logger: ILogger\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n newId: IdGenerator.NewId\n pickleIds: string[]\n supportCodeLibrary: SupportCodeLibrary\n options: IRunOptionsRuntime\n}): IRuntime {\n if (parallel > 0) {\n return new Coordinator({\n cwd,\n logger,\n eventBroadcaster,\n eventDataCollector,\n pickleIds,\n options,\n newId,\n supportCodeLibrary,\n numberOfWorkers: parallel,\n })\n }\n return new Runtime({\n eventBroadcaster,\n eventDataCollector,\n newId,\n pickleIds,\n supportCodeLibrary,\n options,\n })\n}\n"]}
|
package/lib/api/support.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { IdGenerator } from '@cucumber/messages';
|
|
2
2
|
import { SupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
3
|
import { ILogger } from '../logger';
|
|
4
|
-
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }: {
|
|
4
|
+
export declare function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }: {
|
|
5
5
|
logger: ILogger;
|
|
6
6
|
cwd: string;
|
|
7
7
|
newId: IdGenerator.NewId;
|
|
8
8
|
requireModules: string[];
|
|
9
9
|
requirePaths: string[];
|
|
10
10
|
importPaths: string[];
|
|
11
|
+
loaders: string[];
|
|
11
12
|
}): Promise<SupportCodeLibrary>;
|
package/lib/api/support.js
CHANGED
|
@@ -4,14 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getSupportCodeLibrary = void 0;
|
|
7
|
+
const node_module_1 = require("node:module");
|
|
7
8
|
const node_url_1 = require("node:url");
|
|
8
9
|
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
|
|
9
10
|
const try_require_1 = __importDefault(require("../try_require"));
|
|
10
|
-
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, }) {
|
|
11
|
+
async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requirePaths, importPaths, loaders, }) {
|
|
11
12
|
support_code_library_builder_1.default.reset(cwd, newId, {
|
|
12
13
|
requireModules,
|
|
13
14
|
requirePaths,
|
|
14
15
|
importPaths,
|
|
16
|
+
loaders,
|
|
15
17
|
});
|
|
16
18
|
requireModules.map((path) => {
|
|
17
19
|
logger.debug(`Attempting to require code from "${path}"`);
|
|
@@ -21,6 +23,10 @@ async function getSupportCodeLibrary({ logger, cwd, newId, requireModules, requi
|
|
|
21
23
|
logger.debug(`Attempting to require code from "${path}"`);
|
|
22
24
|
(0, try_require_1.default)(path);
|
|
23
25
|
});
|
|
26
|
+
for (const specifier of loaders) {
|
|
27
|
+
logger.debug(`Attempting to register loader "${specifier}"`);
|
|
28
|
+
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
|
|
29
|
+
}
|
|
24
30
|
for (const path of importPaths) {
|
|
25
31
|
logger.debug(`Attempting to import code from "${path}"`);
|
|
26
32
|
await import((0, node_url_1.pathToFileURL)(path).toString());
|
package/lib/api/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAsC;AACtC,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAGhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,MAAM,EACN,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,GASR;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;QACX,OAAO;KACR,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,CAAC,KAAK,CAAC,oCAAoC,IAAI,GAAG,CAAC,CAAA;QACzD,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAA;IAClB,CAAC,CAAC,CAAA;IAEF,KAAK,MAAM,SAAS,IAAI,OAAO,EAAE;QAC/B,MAAM,CAAC,KAAK,CAAC,kCAAkC,SAAS,GAAG,CAAC,CAAA;QAC5D,IAAA,sBAAQ,EAAC,SAAS,EAAE,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACzC;IAED,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,CAAC,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAA;QACxD,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA5CD,sDA4CC","sourcesContent":["import { register } from 'node:module'\nimport { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport tryRequire from '../try_require'\nimport { ILogger } from '../logger'\n\nexport async function getSupportCodeLibrary({\n logger,\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n}: {\n logger: ILogger\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n loaders: string[]\n}): Promise<SupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n loaders,\n })\n\n requireModules.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n requirePaths.map((path) => {\n logger.debug(`Attempting to require code from \"${path}\"`)\n tryRequire(path)\n })\n\n for (const specifier of loaders) {\n logger.debug(`Attempting to register loader \"${specifier}\"`)\n register(specifier, pathToFileURL('./'))\n }\n\n for (const path of importPaths) {\n logger.debug(`Attempting to import code from \"${path}\"`)\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
|
package/lib/api/types.d.ts
CHANGED
|
@@ -144,6 +144,10 @@ export interface ISupportCodeCoordinates {
|
|
|
144
144
|
* Paths and/or glob expressions of user code to load, via `import()`
|
|
145
145
|
*/
|
|
146
146
|
importPaths: string[];
|
|
147
|
+
/**
|
|
148
|
+
* Specifiers of loaders to register, via `register()`
|
|
149
|
+
*/
|
|
150
|
+
loaders: string[];
|
|
147
151
|
}
|
|
148
152
|
/**
|
|
149
153
|
* Options for {@link loadSupport}
|
|
@@ -158,7 +162,7 @@ export interface ILoadSupportOptions {
|
|
|
158
162
|
* feature file locations.
|
|
159
163
|
*/
|
|
160
164
|
sources: ISourcesCoordinates;
|
|
161
|
-
support: ISupportCodeCoordinates
|
|
165
|
+
support: Partial<ISupportCodeCoordinates>;
|
|
162
166
|
}
|
|
163
167
|
/**
|
|
164
168
|
* Options relating to behaviour when actually running tests
|
|
@@ -237,7 +241,7 @@ export interface IRunOptionsFormats {
|
|
|
237
241
|
*/
|
|
238
242
|
export interface IRunConfiguration {
|
|
239
243
|
sources: ISourcesCoordinates;
|
|
240
|
-
support: ISupportCodeCoordinates
|
|
244
|
+
support: Partial<ISupportCodeCoordinates>;
|
|
241
245
|
runtime: IRunOptionsRuntime;
|
|
242
246
|
formats: IRunOptionsFormats;
|
|
243
247
|
}
|
|
@@ -265,7 +269,7 @@ export interface ISupportCodeLibrary {
|
|
|
265
269
|
* test runs happen within the same process. Note this is only useful in serial
|
|
266
270
|
* mode, as parallel workers will each load the support code themselves anyway.
|
|
267
271
|
*/
|
|
268
|
-
export type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
|
|
272
|
+
export type ISupportCodeCoordinatesOrLibrary = Partial<ISupportCodeCoordinates> | ISupportCodeLibrary;
|
|
269
273
|
/**
|
|
270
274
|
* Options for {@link runCucumber}
|
|
271
275
|
* @public
|
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 * @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
|
|
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 * 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 * 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"]}
|
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const commander_1 = require("commander");
|
|
7
7
|
const lodash_merge_1 = __importDefault(require("lodash.merge"));
|
|
8
8
|
const gherkin_1 = require("@cucumber/gherkin");
|
|
9
|
-
const formatters_1 = __importDefault(require("../formatter/helpers/formatters"));
|
|
10
9
|
const version_1 = require("../version");
|
|
10
|
+
const builtin_1 = __importDefault(require("../formatter/builtin"));
|
|
11
11
|
const ArgvParser = {
|
|
12
12
|
collect(val, memo = []) {
|
|
13
13
|
if (val) {
|
|
@@ -59,11 +59,12 @@ const ArgvParser = {
|
|
|
59
59
|
.option('--exit, --force-exit', 'force shutdown of the event loop when the test run has finished: cucumber will call process.exit')
|
|
60
60
|
.option('--fail-fast', 'abort the run on first failure')
|
|
61
61
|
.option('-f, --format <TYPE[:PATH]>', 'specify the output format, optionally supply PATH to redirect formatter output (repeatable). Available formats:\n' +
|
|
62
|
-
|
|
62
|
+
Object.entries(builtin_1.default).reduce((previous, [key, formatter]) => previous + ` ${key}: ${formatter.documentation}\n`, ''), ArgvParser.collect)
|
|
63
63
|
.option('--format-options <JSON>', 'provide options for formatters (repeatable)', ArgvParser.mergeJson('--format-options'))
|
|
64
64
|
.option('--i18n-keywords <ISO 639-1>', 'list language keywords', ArgvParser.validateLanguage)
|
|
65
65
|
.option('--i18n-languages', 'list languages')
|
|
66
66
|
.option('-i, --import <GLOB|DIR|FILE>', 'import files before executing features (repeatable)', ArgvParser.collect)
|
|
67
|
+
.option('-l, --loader <NODE_MODULE>', 'module specifier(s) for loaders to be registered ahead of loading support code', ArgvParser.collect)
|
|
67
68
|
.option('--language <ISO 639-1>', 'provide the default language for feature files')
|
|
68
69
|
.option('--name <REGEXP>', 'only execute the scenarios with name matching the expression (repeatable)', ArgvParser.collect)
|
|
69
70
|
.option('--order <TYPE[:SEED]>', 'run scenarios in the specified order. Type should be `defined` or `random`')
|