@cucumber/cucumber 9.6.0 → 10.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/lib/api/console_logger.d.ts +1 -1
- package/lib/api/console_logger.js +5 -2
- package/lib/api/console_logger.js.map +1 -1
- package/lib/api/convert_configuration.d.ts +1 -1
- package/lib/api/convert_configuration.js +2 -2
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +2 -2
- package/lib/api/formatters.js +6 -6
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.d.ts +1 -1
- package/lib/api/gherkin.js +1 -1
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/load_configuration.js +1 -2
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.js +1 -1
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +1 -1
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/paths.d.ts +1 -1
- package/lib/api/paths.js +18 -17
- package/lib/api/paths.js.map +1 -1
- package/lib/api/plugins.d.ts +1 -1
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +2 -2
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +3 -3
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.js +2 -4
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.js +8 -8
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/api/types.d.ts +1 -1
- package/lib/api/types.js.map +1 -1
- package/lib/cli/helpers.d.ts +4 -4
- package/lib/cli/helpers.js +5 -5
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/index.js +6 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.js +4 -4
- package/lib/cli/validate_node_engine_version.js.map +1 -1
- package/lib/configuration/from_file.d.ts +1 -1
- package/lib/configuration/from_file.js +41 -21
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/locate_file.js +2 -2
- package/lib/configuration/locate_file.js.map +1 -1
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/validate_configuration.d.ts +1 -1
- package/lib/configuration/validate_configuration.js +3 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/filter_stack_trace.js +4 -4
- package/lib/filter_stack_trace.js.map +1 -1
- package/lib/formatter/builder.d.ts +5 -5
- package/lib/formatter/builder.js +11 -24
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +1 -1
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +1 -1
- package/lib/formatter/helpers/event_data_collector.js +5 -5
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +2 -2
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.d.ts +1 -1
- package/lib/formatter/helpers/summary_helpers.js +1 -1
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +3 -3
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.js +6 -5
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/index.d.ts +3 -3
- package/lib/formatter/index.js +10 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -1
- package/lib/formatter/json_formatter.js +10 -8
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/junit_formatter.js +11 -12
- package/lib/formatter/junit_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.js +1 -1
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -1
- package/lib/formatter/progress_bar_formatter.js +8 -4
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -1
- package/lib/formatter/progress_formatter.js +3 -3
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +5 -4
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +4 -4
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js +3 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -1
- package/lib/formatter/summary_formatter.js +4 -4
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +4 -4
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +2 -2
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +1 -0
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/definition.d.ts +1 -1
- package/lib/models/definition.js +6 -0
- package/lib/models/definition.js.map +1 -1
- package/lib/models/step_definition.d.ts +1 -1
- package/lib/models/step_definition.js +5 -2
- package/lib/models/step_definition.js.map +1 -1
- package/lib/models/test_case_hook_definition.d.ts +1 -1
- package/lib/models/test_case_hook_definition.js +3 -0
- package/lib/models/test_case_hook_definition.js.map +1 -1
- package/lib/models/test_step_hook_definition.d.ts +1 -1
- package/lib/models/test_step_hook_definition.js +2 -0
- package/lib/models/test_step_hook_definition.js.map +1 -1
- package/lib/pickle_filter.js +11 -5
- package/lib/pickle_filter.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +1 -1
- package/lib/plugin/plugin_manager.js +3 -2
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +1 -1
- package/lib/plugin/types.js.map +1 -1
- package/lib/publish/http_stream.d.ts +2 -2
- package/lib/publish/http_stream.js +14 -9
- package/lib/publish/http_stream.js.map +1 -1
- package/lib/publish/publish_plugin.js +3 -3
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/runtime/assemble_test_cases.d.ts +1 -1
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +1 -1
- package/lib/runtime/attachment_manager/index.js +1 -0
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/format_error.js +1 -1
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -1
- package/lib/runtime/helpers.js +2 -2
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +1 -1
- package/lib/runtime/index.js +9 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +4 -4
- package/lib/runtime/parallel/coordinator.js +24 -5
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js +14 -6
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.js +1 -1
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/step_runner.js +2 -2
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +2 -0
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +1 -1
- package/lib/runtime/test_case_runner.js +19 -3
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/step_arguments.js +2 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +2 -2
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +1 -1
- package/lib/support_code_library_builder/index.js +24 -8
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +1 -4
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -1
- package/lib/support_code_library_builder/world.js +3 -0
- package/lib/support_code_library_builder/world.js.map +1 -1
- package/lib/time.d.ts +1 -1
- package/lib/time.js +2 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +3 -3
- package/lib/user_code_runner.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 +16 -14
- package/lib/formatter/fixtures/typescript.d.ts +0 -2
- package/lib/formatter/fixtures/typescript.js +0 -6
- package/lib/formatter/fixtures/typescript.js.map +0 -1
- package/lib/importer.js +0 -13
package/README.md
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
[](https://vshymanskyy.github.io/StandWithUkraine)
|
|
11
11
|
[](https://www.npmjs.com/package/@cucumber/cucumber)
|
|
12
|
-
[](https://github.com/cucumber/cucumber-js/actions)
|
|
13
|
+
[](https://coveralls.io/github/cucumber/cucumber-js?branch=master)
|
|
14
14
|
[](https://opencollective.com/cucumber)
|
|
15
15
|
[](https://opencollective.com/cucumber)
|
|
16
16
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConsoleLogger = void 0;
|
|
4
|
-
const
|
|
4
|
+
const node_console_1 = require("node:console");
|
|
5
5
|
class ConsoleLogger {
|
|
6
|
+
stream;
|
|
7
|
+
debugEnabled;
|
|
8
|
+
console;
|
|
6
9
|
constructor(stream, debugEnabled) {
|
|
7
10
|
this.stream = stream;
|
|
8
11
|
this.debugEnabled = debugEnabled;
|
|
9
|
-
this.console = new
|
|
12
|
+
this.console = new node_console_1.Console(this.stream);
|
|
10
13
|
}
|
|
11
14
|
debug(...content) {
|
|
12
15
|
if (this.debugEnabled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console_logger.js","sourceRoot":"","sources":["../../src/api/console_logger.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"console_logger.js","sourceRoot":"","sources":["../../src/api/console_logger.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AAItC,MAAa,aAAa;IAGd;IACA;IAHF,OAAO,CAAS;IACxB,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,GAAG,OAAc;QACrB,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAA;SAC/B;IACH,CAAC;IAED,KAAK,CAAC,GAAG,OAAc;QACrB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,CAAA;IAChC,CAAC;IAED,IAAI,CAAC,GAAG,OAAc;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAA;IAC/B,CAAC;CACF;AAtBD,sCAsBC","sourcesContent":["import { Console } from 'node:console'\nimport { Writable } from 'node:stream'\nimport { ILogger } from '../logger'\n\nexport class ConsoleLogger implements ILogger {\n private console: Console\n constructor(\n private stream: Writable,\n private debugEnabled: boolean\n ) {\n this.console = new Console(this.stream)\n }\n\n debug(...content: any[]): void {\n if (this.debugEnabled) {\n this.console.debug(...content)\n }\n }\n\n error(...content: any[]): void {\n this.console.error(...content)\n }\n\n warn(...content: any[]): void {\n this.console.warn(...content)\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { IConfiguration } from '../configuration';
|
|
3
|
-
import { IRunConfiguration } from './types';
|
|
4
3
|
import { ILogger } from '../logger';
|
|
4
|
+
import { IRunConfiguration } from './types';
|
|
5
5
|
export declare function convertConfiguration(logger: ILogger, flatConfiguration: IConfiguration, env: NodeJS.ProcessEnv): Promise<IRunConfiguration>;
|
|
@@ -31,10 +31,10 @@ async function convertConfiguration(logger, flatConfiguration, env) {
|
|
|
31
31
|
}
|
|
32
32
|
exports.convertConfiguration = convertConfiguration;
|
|
33
33
|
function convertFormats(logger, flatConfiguration, env) {
|
|
34
|
-
var _a, _b;
|
|
35
34
|
const splitFormats = flatConfiguration.format.map((item) => Array.isArray(item) ? item : (0, configuration_1.splitFormatDescriptor)(logger, item));
|
|
36
35
|
return {
|
|
37
|
-
stdout:
|
|
36
|
+
stdout: [...splitFormats].reverse().find(([, target]) => !target)?.[0] ??
|
|
37
|
+
'progress',
|
|
38
38
|
files: splitFormats
|
|
39
39
|
.filter(([, target]) => !!target)
|
|
40
40
|
.reduce((mapped, [type, target]) => {
|
|
@@ -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;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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 '../formatter'\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 },\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
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'node:events';
|
|
3
4
|
import { IFormatterStream } from '../formatter';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
5
5
|
import { EventDataCollector } from '../formatter/helpers';
|
|
6
6
|
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
|
-
import { IRunOptionsFormats } from './types';
|
|
8
7
|
import { ILogger } from '../logger';
|
|
8
|
+
import { IRunOptionsFormats } from './types';
|
|
9
9
|
export declare function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, }: {
|
|
10
10
|
env: NodeJS.ProcessEnv;
|
|
11
11
|
cwd: string;
|
package/lib/api/formatters.js
CHANGED
|
@@ -4,11 +4,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.initializeFormatters = void 0;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const node_util_1 = require("node:util");
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const fs_1 = __importDefault(require("mz/fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
10
|
const mkdirp_1 = require("mkdirp");
|
|
11
|
+
const builder_1 = __importDefault(require("../formatter/builder"));
|
|
12
12
|
async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, eventBroadcaster, eventDataCollector, configuration, supportCodeLibrary, }) {
|
|
13
13
|
async function initializeFormatter(stream, target, type) {
|
|
14
14
|
stream.on('error', (error) => {
|
|
@@ -25,7 +25,7 @@ async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, e
|
|
|
25
25
|
stream,
|
|
26
26
|
cleanup: stream === stdout
|
|
27
27
|
? async () => await Promise.resolve()
|
|
28
|
-
: (0,
|
|
28
|
+
: (0, node_util_1.promisify)(stream.end.bind(stream)),
|
|
29
29
|
supportCodeLibrary,
|
|
30
30
|
};
|
|
31
31
|
if (type === 'progress-bar' && !stream.isTTY) {
|
|
@@ -39,9 +39,9 @@ async function initializeFormatters({ env, cwd, stdout, logger, onStreamError, e
|
|
|
39
39
|
const streamPromises = [];
|
|
40
40
|
Object.entries(configuration.files).forEach(([target, type]) => {
|
|
41
41
|
streamPromises.push((async (target, type) => {
|
|
42
|
-
const absoluteTarget =
|
|
42
|
+
const absoluteTarget = node_path_1.default.resolve(cwd, target);
|
|
43
43
|
try {
|
|
44
|
-
await (0, mkdirp_1.mkdirp)(
|
|
44
|
+
await (0, mkdirp_1.mkdirp)(node_path_1.default.dirname(absoluteTarget));
|
|
45
45
|
}
|
|
46
46
|
catch (error) {
|
|
47
47
|
logger.warn('Failed to ensure directory for formatter target exists');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/api/formatters.ts"],"names":[],"mappings":";;;;;;AACA,yCAAqC;AAErC,0DAA4B;AAC5B,+CAAsB;AACtB,mCAA+B;AAI/B,mEAAmD;AAI5C,KAAK,UAAU,oBAAoB,CAAC,EACzC,GAAG,EACH,GAAG,EACH,MAAM,EACN,MAAM,EACN,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,kBAAkB,GAYnB;IACC,KAAK,UAAU,mBAAmB,CAChC,MAAwB,EACxB,MAAc,EACd,IAAY;QAEZ,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAY,EAAE,EAAE;YAClC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAC3B,aAAa,EAAE,CAAA;QACjB,CAAC,CAAC,CAAA;QACF,MAAM,WAAW,GAAG;YAClB,GAAG;YACH,GAAG;YACH,gBAAgB;YAChB,kBAAkB;YAClB,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAC9B,iBAAiB,EAAE,aAAa,CAAC,OAAO;YACxC,MAAM;YACN,OAAO,EACL,MAAM,KAAK,MAAM;gBACf,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,MAAM,OAAO,CAAC,OAAO,EAAE;gBACrC,CAAC,CAAC,IAAA,qBAAS,EAAM,MAAM,CAAC,GAAG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AC,MAAM,EAAE,IAAI,CAAC,CACjB,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;IAEjC,OAAO,KAAK;QACV,MAAM,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACpE,CAAC,CAAA;AACH,CAAC;AAtFD,oDAsFC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { promisify } from 'node:util'\nimport { WriteStream as TtyWriteStream } from 'node:tty'\nimport path from 'node:path'\nimport fs from 'mz/fs'\nimport { mkdirp } from 'mkdirp'\nimport Formatter, { IFormatterStream } from '../formatter'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { ILogger } from '../logger'\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}: {\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: ISupportCodeLibrary\n}): Promise<() => Promise<void>> {\n async function initializeFormatter(\n stream: IFormatterStream,\n target: string,\n type: string\n ): Promise<Formatter> {\n stream.on('error', (error: Error) => {\n logger.error(error.message)\n onStreamError()\n })\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 if (type === '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 type = 'progress'\n }\n return await FormatterBuilder.build(type, typeOptions)\n }\n\n const formatters: Formatter[] = []\n\n formatters.push(\n await initializeFormatter(stdout, 'stdout', configuration.stdout)\n )\n\n const streamPromises: Promise<void>[] = []\n\n Object.entries(configuration.files).forEach(([target, type]) => {\n streamPromises.push(\n (async (target, type) => {\n const absoluteTarget = path.resolve(cwd, target)\n\n try {\n await mkdirp(path.dirname(absoluteTarget))\n } catch (error) {\n logger.warn('Failed to ensure directory for formatter target exists')\n }\n\n const stream: IFormatterStream = fs.createWriteStream(null, {\n fd: await fs.open(absoluteTarget, 'w'),\n })\n formatters.push(await initializeFormatter(stream, target, type))\n })(target, type)\n )\n })\n\n await Promise.all(streamPromises)\n\n return async function () {\n await Promise.all(formatters.map(async (f) => await f.finished()))\n }\n}\n"]}
|
package/lib/api/gherkin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Envelope, GherkinDocument, IdGenerator, Location, ParseError, Pickle } from '@cucumber/messages';
|
|
2
|
-
import { ISourcesCoordinates } from './types';
|
|
3
2
|
import { ILogger } from '../logger';
|
|
3
|
+
import { ISourcesCoordinates } from './types';
|
|
4
4
|
interface PickleWithDocument {
|
|
5
5
|
gherkinDocument: GherkinDocument;
|
|
6
6
|
location: Location;
|
package/lib/api/gherkin.js
CHANGED
|
@@ -20,7 +20,7 @@ async function getFilteredPicklesAndErrors({ newId, cwd, logger, unexpandedFeatu
|
|
|
20
20
|
if (envelope.parseError) {
|
|
21
21
|
parseErrors.push(envelope.parseError);
|
|
22
22
|
}
|
|
23
|
-
onEnvelope
|
|
23
|
+
onEnvelope?.(envelope);
|
|
24
24
|
});
|
|
25
25
|
const pickleFilter = new pickle_filter_1.default({
|
|
26
26
|
cwd,
|
package/lib/api/gherkin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;;;;AAAA,+DAGkC;AASlC,2DAA+D;AAC/D,qEAA2C;AAC3C,4CAA6C;AAUtC,KAAK,UAAU,2BAA2B,CAAC,EAChD,KAAK,EACL,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,UAAU,GASX;IAIC,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;IACvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,gBAAgB,CACpB,YAAY,EACZ;QACE,KAAK;QACL,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,WAAW,CAAC,cAAc;KAC3C,EACD,CAAC,QAAQ,EAAE,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC7B,IAAI,QAAQ,CAAC,UAAU,EAAE;YACvB,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;SACtC;QACD,UAAU,
|
|
1
|
+
{"version":3,"file":"gherkin.js","sourceRoot":"","sources":["../../src/api/gherkin.ts"],"names":[],"mappings":";;;;;;AAAA,+DAGkC;AASlC,2DAA+D;AAC/D,qEAA2C;AAC3C,4CAA6C;AAUtC,KAAK,UAAU,2BAA2B,CAAC,EAChD,KAAK,EACL,GAAG,EACH,MAAM,EACN,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,UAAU,GASX;IAIC,MAAM,YAAY,GAAG,IAAI,qBAAY,EAAE,CAAA;IACvC,MAAM,WAAW,GAAiB,EAAE,CAAA;IACpC,MAAM,gBAAgB,CACpB,YAAY,EACZ;QACE,KAAK;QACL,UAAU,EAAE,GAAG;QACf,cAAc,EAAE,WAAW,CAAC,cAAc;KAC3C,EACD,CAAC,QAAQ,EAAE,EAAE;QACX,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;QAC7B,IAAI,QAAQ,CAAC,U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CAC7B,KAAe,EACf,OAA8B,EAC9B,UAAwC;IAExC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,oBAAoB,GAAG,gCAAc,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACrE,oBAAoB,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,CAAA;QAC3C,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QACvC,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import {\n GherkinStreams,\n IGherkinStreamOptions,\n} from '@cucumber/gherkin-streams'\nimport {\n Envelope,\n GherkinDocument,\n IdGenerator,\n Location,\n ParseError,\n Pickle,\n} from '@cucumber/messages'\nimport { Query as GherkinQuery } from '@cucumber/gherkin-utils'\nimport PickleFilter from '../pickle_filter'\nimport { orderPickles } from '../cli/helpers'\nimport { ILogger } from '../logger'\nimport { ISourcesCoordinates } from './types'\n\ninterface PickleWithDocument {\n gherkinDocument: GherkinDocument\n location: Location\n pickle: Pickle\n}\n\nexport async function getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n onEnvelope,\n}: {\n newId: IdGenerator.NewId\n cwd: string\n logger: ILogger\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n coordinates: ISourcesCoordinates\n onEnvelope?: (envelope: Envelope) => void\n}): Promise<{\n filteredPickles: PickleWithDocument[]\n parseErrors: ParseError[]\n}> {\n const gherkinQuery = new GherkinQuery()\n const parseErrors: ParseError[] = []\n await gherkinFromPaths(\n featurePaths,\n {\n newId,\n relativeTo: cwd,\n defaultDialect: coordinates.defaultDialect,\n },\n (envelope) => {\n gherkinQuery.update(envelope)\n if (envelope.parseError) {\n parseErrors.push(envelope.parseError)\n }\n onEnvelope?.(envelope)\n }\n )\n const pickleFilter = new PickleFilter({\n cwd,\n featurePaths: unexpandedFeaturePaths,\n names: coordinates.names,\n tagExpression: coordinates.tagExpression,\n })\n const filteredPickles: PickleWithDocument[] = gherkinQuery\n .getPickles()\n .filter((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n return pickleFilter.matches({ gherkinDocument, pickle })\n })\n .map((pickle) => {\n const gherkinDocument = gherkinQuery\n .getGherkinDocuments()\n .find((doc) => doc.uri === pickle.uri)\n const location = gherkinQuery.getLocation(\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n )\n return {\n gherkinDocument,\n location,\n pickle,\n }\n })\n orderPickles(filteredPickles, coordinates.order, logger)\n return {\n filteredPickles,\n parseErrors,\n }\n}\n\nasync function gherkinFromPaths(\n paths: string[],\n options: IGherkinStreamOptions,\n onEnvelope: (envelope: Envelope) => void\n): Promise<void> {\n return new Promise((resolve, reject) => {\n const gherkinMessageStream = GherkinStreams.fromPaths(paths, options)\n gherkinMessageStream.on('data', onEnvelope)\n gherkinMessageStream.on('end', resolve)\n gherkinMessageStream.on('error', reject)\n })\n}\n"]}
|
|
@@ -15,10 +15,9 @@ const console_logger_1 = require("./console_logger");
|
|
|
15
15
|
* @param environment - Project environment.
|
|
16
16
|
*/
|
|
17
17
|
async function loadConfiguration(options = {}, environment = {}) {
|
|
18
|
-
var _a;
|
|
19
18
|
const { cwd, stderr, env, debug } = (0, environment_1.mergeEnvironment)(environment);
|
|
20
19
|
const logger = new console_logger_1.ConsoleLogger(stderr, debug);
|
|
21
|
-
const configFile =
|
|
20
|
+
const configFile = options.file ?? (0, locate_file_1.locateFile)(cwd);
|
|
22
21
|
if (configFile) {
|
|
23
22
|
logger.debug(`Configuration will be loaded from "${configFile}"`);
|
|
24
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_configuration.js","sourceRoot":"","sources":["../../src/api/load_configuration.ts"],"names":[],"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B,EAAE,QAAQ;KAC3B,CAAA;AACH,CAAC;AA3BD,8CA2BC","sourcesContent":["import { locateFile } from '../configuration/locate_file'\nimport {\n DEFAULT_CONFIGURATION,\n fromFile,\n mergeConfigurations,\n} from '../configuration'\nimport { validateConfiguration } from '../configuration/validate_configuration'\nimport { ILogger } from '../logger'\nimport { convertConfiguration } from './convert_configuration'\nimport { mergeEnvironment } from './environment'\nimport {\n IRunEnvironment,\n IResolvedConfiguration,\n ILoadConfigurationOptions,\n} from './types'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Load user-authored configuration to be used in a test run.\n *\n * @public\n * @param options - Coordinates required to find configuration.\n * @param environment - Project environment.\n */\nexport async function loadConfiguration(\n options: ILoadConfigurationOptions = {},\n environment: IRunEnvironment = {}\n): Promise<IResolvedConfiguration> {\n const { cwd, stderr, env, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const configFile = options.file ?? locateFile(cwd)\n if (configFile) {\n logger.debug(`Configuration will be loaded from \"${configFile}\"`)\n } else {\n logger.debug('No configuration file found')\n }\n const profileConfiguration = configFile\n ? await fromFile(logger, cwd, configFile, options.profiles)\n : {}\n const original = mergeConfigurations(\n DEFAULT_CONFIGURATION,\n profileConfiguration,\n options.provided\n )\n logger.debug('Resolved configuration:', original)\n validateConfiguration(original, logger)\n const runnable = await convertConfiguration(logger, original, env)\n return {\n useConfiguration: original,\n runConfiguration: runnable,\n }\n}\n"]}
|
package/lib/api/load_sources.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.loadSources = void 0;
|
|
4
|
-
const paths_1 = require("./paths");
|
|
5
4
|
const messages_1 = require("@cucumber/messages");
|
|
5
|
+
const paths_1 = require("./paths");
|
|
6
6
|
const environment_1 = require("./environment");
|
|
7
7
|
const gherkin_1 = require("./gherkin");
|
|
8
8
|
const console_logger_1 = require("./console_logger");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAShD,mCAAsC;AACtC,+CAAgD;AAChD,uCAAuD;AACvD,qDAAgD;AAEhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAY,EACjE,MAAM,EACN,GAAG,EACH,WAAW,CACZ,CAAA;IACD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;QAC7B,OAAO;YACL,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;SACX,CAAA;KACF;IACD,MAAM,EAAE,eAAe,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,qCAA2B,EAAC;QACzE,KAAK;QACL,GAAG;QACH,MAAM;QACN,sBAAsB;QACtB,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IACF,MAAM,IAAI,GAAqB,eAAe,CAAC,GAAG,CAChD,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,QAAQ;KACT,CAAC,CACH,CAAA;IACD,MAAM,MAAM,GAAoB,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;QACtE,OAAO;YACL,GAAG,EAAE,MAAM,CAAC,GAAG;YACf,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CAAA;IACF,OAAO;QACL,IAAI;QACJ,MAAM;KACP,CAAA;AACH,CAAC;AA5CD,kCA4CC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ILogger } from '../logger'\nimport {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { resolvePaths } from './paths'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Load and parse features, produce a filtered and ordered test plan and/or parse errors.\n *\n * @public\n * @param coordinates - Coordinates required to find features\n * @param environment - Project environment.\n */\nexport async function loadSources(\n coordinates: ISourcesCoordinates,\n environment: IRunEnvironment = {}\n): Promise<ILoadSourcesResult> {\n const { cwd, stderr, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const newId = IdGenerator.uuid()\n const { unexpandedFeaturePaths, featurePaths } = await resolvePaths(\n logger,\n cwd,\n coordinates\n )\n if (featurePaths.length === 0) {\n return {\n plan: [],\n errors: [],\n }\n }\n const { filteredPickles, parseErrors } = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates,\n })\n const plan: IPlannedPickle[] = filteredPickles.map(\n ({ location, pickle }) => ({\n name: pickle.name,\n uri: pickle.uri,\n location,\n })\n )\n const errors: ISourcesError[] = parseErrors.map(({ source, message }) => {\n return {\n uri: source.uri,\n location: source.location,\n message,\n }\n })\n return {\n plan,\n errors,\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;
|
|
1
|
+
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAIhD,mCAAsC;AACtC,uCAAiD;AACjD,+CAAgD;AAChD,qDAAgD;AAEhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACxD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAY,EACtD,MAAM,EACN,GAAG,EACH,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,OAAO,CAChB,CAAA;IACD,OAAO,MAAM,IAAA,+BAAqB,EAAC;QACjC,GAAG;QACH,KAAK;QACL,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,cAAc;QAC9C,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;AACJ,CAAC;AApBD,kCAoBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { ILogger } from '../logger'\nimport { ILoadSupportOptions, IRunEnvironment } from './types'\nimport { resolvePaths } from './paths'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Load support code for use in test runs.\n *\n * @public\n * @param options - Subset of `IRunnableConfiguration` 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 { cwd, stderr, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n const newId = IdGenerator.uuid()\n const { requirePaths, importPaths } = await resolvePaths(\n logger,\n cwd,\n options.sources,\n options.support\n )\n return await getSupportCodeLibrary({\n cwd,\n newId,\n requireModules: options.support.requireModules,\n requirePaths,\n importPaths,\n })\n}\n"]}
|
package/lib/api/paths.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ISourcesCoordinates, ISupportCodeCoordinates } from './types';
|
|
2
1
|
import { ILogger } from '../logger';
|
|
2
|
+
import { ISourcesCoordinates, ISupportCodeCoordinates } from './types';
|
|
3
3
|
export declare function resolvePaths(logger: ILogger, cwd: string, sources: Pick<ISourcesCoordinates, 'paths'>, support?: ISupportCodeCoordinates): Promise<{
|
|
4
4
|
unexpandedFeaturePaths: string[];
|
|
5
5
|
featurePaths: string[];
|
package/lib/api/paths.js
CHANGED
|
@@ -4,9 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.resolvePaths = void 0;
|
|
7
|
-
const
|
|
8
|
-
const glob_1 =
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
const glob_1 = require("glob");
|
|
10
9
|
const fs_1 = __importDefault(require("mz/fs"));
|
|
11
10
|
async function resolvePaths(logger, cwd, sources, support = {
|
|
12
11
|
requireModules: [],
|
|
@@ -29,27 +28,30 @@ async function resolvePaths(logger, cwd, sources, support = {
|
|
|
29
28
|
exports.resolvePaths = resolvePaths;
|
|
30
29
|
async function expandPaths(cwd, unexpandedPaths, defaultExtension) {
|
|
31
30
|
const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
|
|
32
|
-
const matches = await (0,
|
|
31
|
+
const matches = await (0, glob_1.glob)(unexpandedPath, {
|
|
33
32
|
absolute: true,
|
|
33
|
+
windowsPathsNoEscape: true,
|
|
34
34
|
cwd,
|
|
35
35
|
});
|
|
36
36
|
const expanded = await Promise.all(matches.map(async (match) => {
|
|
37
|
-
if (
|
|
38
|
-
return
|
|
37
|
+
if (node_path_1.default.extname(match) === '') {
|
|
38
|
+
return (0, glob_1.glob)(`${match}/**/*${defaultExtension}`, {
|
|
39
|
+
windowsPathsNoEscape: true,
|
|
40
|
+
});
|
|
39
41
|
}
|
|
40
42
|
return [match];
|
|
41
43
|
}));
|
|
42
|
-
return expanded.flat();
|
|
44
|
+
return expanded.flat().sort();
|
|
43
45
|
}));
|
|
44
|
-
const normalized = expandedPaths.flat().map((x) =>
|
|
46
|
+
const normalized = expandedPaths.flat().map((x) => node_path_1.default.normalize(x));
|
|
45
47
|
return [...new Set(normalized)];
|
|
46
48
|
}
|
|
47
49
|
async function getUnexpandedFeaturePaths(cwd, args) {
|
|
48
50
|
if (args.length > 0) {
|
|
49
51
|
const nestedFeaturePaths = await Promise.all(args.map(async (arg) => {
|
|
50
|
-
const filename =
|
|
52
|
+
const filename = node_path_1.default.basename(arg);
|
|
51
53
|
if (filename[0] === '@') {
|
|
52
|
-
const filePath =
|
|
54
|
+
const filePath = node_path_1.default.join(cwd, arg);
|
|
53
55
|
const content = await fs_1.default.readFile(filePath, 'utf8');
|
|
54
56
|
return content.split('\n').map((x) => x.trim());
|
|
55
57
|
}
|
|
@@ -64,18 +66,18 @@ async function getUnexpandedFeaturePaths(cwd, args) {
|
|
|
64
66
|
}
|
|
65
67
|
function getFeatureDirectoryPaths(cwd, featurePaths) {
|
|
66
68
|
const featureDirs = featurePaths.map((featurePath) => {
|
|
67
|
-
let featureDir =
|
|
69
|
+
let featureDir = node_path_1.default.dirname(featurePath);
|
|
68
70
|
let childDir;
|
|
69
71
|
let parentDir = featureDir;
|
|
70
72
|
while (childDir !== parentDir) {
|
|
71
73
|
childDir = parentDir;
|
|
72
|
-
parentDir =
|
|
73
|
-
if (
|
|
74
|
+
parentDir = node_path_1.default.dirname(childDir);
|
|
75
|
+
if (node_path_1.default.basename(parentDir) === 'features') {
|
|
74
76
|
featureDir = parentDir;
|
|
75
77
|
break;
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
|
-
return
|
|
80
|
+
return node_path_1.default.relative(cwd, featureDir);
|
|
79
81
|
});
|
|
80
82
|
return [...new Set(featureDirs)];
|
|
81
83
|
}
|
|
@@ -87,9 +89,8 @@ async function deriveSupportPaths(cwd, featurePaths, unexpandedRequirePaths, une
|
|
|
87
89
|
if (unexpandedRequirePaths.length === 0 &&
|
|
88
90
|
unexpandedImportPaths.length === 0) {
|
|
89
91
|
const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths);
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
return { requirePaths, importPaths };
|
|
92
|
+
const importPaths = await expandPaths(cwd, defaultPaths, '.@(js|cjs|mjs)');
|
|
93
|
+
return { requirePaths: [], importPaths };
|
|
93
94
|
}
|
|
94
95
|
const requirePaths = unexpandedRequirePaths.length > 0
|
|
95
96
|
? await expandPaths(cwd, unexpandedRequirePaths, '.js')
|
package/lib/api/paths.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/api/paths.ts"],"names":[],"mappings":";;;;;;AAAA
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/api/paths.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+BAA2B;AAC3B,+CAAsB;AAIf,KAAK,UAAU,YAAY,CAChC,MAAe,EACf,GAAW,EACX,OAA2C,EAC3C,UAAmC;IACjC,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,EAAE;IAChB,WAAW,EAAE,EAAE;CAChB;IAOD,MAAM,sBAAsB,GAAG,MAAM,yBAAyB,CAC5D,GAAG,EACH,OAAO,CAAC,KAAK,CACd,CAAA;IACD,MAAM,YAAY,GAAa,MAAM,kBAAkB,CACrD,GAAG,EACH,sBA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,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,CAAA;KACzC;IACD,MAAM,YAAY,GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import path from 'node:path'\nimport { glob } from 'glob'\nimport fs from 'mz/fs'\nimport { ILogger } from '../logger'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from './types'\n\nexport async function resolvePaths(\n logger: ILogger,\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n }\n): Promise<{\n unexpandedFeaturePaths: string[]\n featurePaths: string[]\n requirePaths: string[]\n importPaths: string[]\n}> {\n const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(\n cwd,\n sources.paths\n )\n const featurePaths: string[] = await expandFeaturePaths(\n cwd,\n unexpandedFeaturePaths\n )\n logger.debug('Found feature files based on configuration:', featurePaths)\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n featurePaths,\n support.requirePaths,\n support.importPaths\n )\n logger.debug(\n 'Found support files to load via `require` based on configuration:',\n requirePaths\n )\n logger.debug(\n 'Found support files to load via `import` based on configuration:',\n importPaths\n )\n return {\n unexpandedFeaturePaths,\n featurePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await glob(unexpandedPath, {\n absolute: true,\n windowsPathsNoEscape: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return glob(`${match}/**/*${defaultExtension}`, {\n windowsPathsNoEscape: true,\n })\n }\n return [match]\n })\n )\n return expanded.flat().sort()\n })\n )\n const normalized = expandedPaths.flat().map((x) => path.normalize(x))\n return [...new Set(normalized)]\n}\n\nasync function getUnexpandedFeaturePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandFeaturePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const importPaths = await expandPaths(cwd, defaultPaths, '.@(js|cjs|mjs)')\n return { requirePaths: [], importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
|
package/lib/api/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PluginManager } from '../plugin';
|
|
2
|
-
import { IRunEnvironment, IRunOptions } from './types';
|
|
3
2
|
import { ILogger } from '../logger';
|
|
3
|
+
import { IRunEnvironment, IRunOptions } from './types';
|
|
4
4
|
export declare function initializePlugins(logger: ILogger, configuration: IRunOptions, environment: IRunEnvironment): Promise<PluginManager>;
|
package/lib/api/plugins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAiD;AACjD,yDAAsC;AAItC,MAAM,gBAAgB,GAA2B;IAC/C,OAAO,EAAE,iBAAa;CACvB,CAAA;AAEM,KAAK,UAAU,iBAAiB,CACrC,MAAe,EACf,aAA0B,EAC1B,WAA4B;IAE5B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACxE,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;IAC5D,OAAO,aAAa,CAAA;AACtB,CAAC;AATD,8CASC","sourcesContent":["import { Plugin, PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport {
|
|
1
|
+
{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../src/api/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,sCAAiD;AACjD,yDAAsC;AAItC,MAAM,gBAAgB,GAA2B;IAC/C,OAAO,EAAE,iBAAa;CACvB,CAAA;AAEM,KAAK,UAAU,iBAAiB,CACrC,MAAe,EACf,aAA0B,EAC1B,WAA4B;IAE5B,6CAA6C;IAC7C,MAAM,aAAa,GAAG,IAAI,sBAAa,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAA;IACxE,MAAM,aAAa,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,CAAA;IAC5D,OAAO,aAAa,CAAA;AACtB,CAAC;AATD,8CASC","sourcesContent":["import { Plugin, PluginManager } from '../plugin'\nimport publishPlugin from '../publish'\nimport { ILogger } from '../logger'\nimport { IRunEnvironment, IRunOptions } from './types'\n\nconst INTERNAL_PLUGINS: Record<string, Plugin> = {\n publish: publishPlugin,\n}\n\nexport async function initializePlugins(\n logger: ILogger,\n configuration: IRunOptions,\n environment: IRunEnvironment\n): Promise<PluginManager> {\n // eventually we'll load plugin packages here\n const pluginManager = new PluginManager(Object.values(INTERNAL_PLUGINS))\n await pluginManager.init(logger, configuration, environment)\n return pluginManager\n}\n"]}
|
package/lib/api/run_cucumber.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runCucumber = void 0;
|
|
4
|
+
const node_events_1 = require("node:events");
|
|
4
5
|
const messages_1 = require("@cucumber/messages");
|
|
5
|
-
const events_1 = require("events");
|
|
6
6
|
const helpers_1 = require("../formatter/helpers");
|
|
7
7
|
const helpers_2 = require("../cli/helpers");
|
|
8
8
|
const paths_1 = require("./paths");
|
|
@@ -39,7 +39,7 @@ async function runCucumber(configuration, environment = {}, onMessage) {
|
|
|
39
39
|
requireModules: supportCoordinates.requireModules,
|
|
40
40
|
});
|
|
41
41
|
const plugins = await (0, plugins_1.initializePlugins)(logger, configuration, environment);
|
|
42
|
-
const eventBroadcaster = new
|
|
42
|
+
const eventBroadcaster = new node_events_1.EventEmitter();
|
|
43
43
|
if (onMessage) {
|
|
44
44
|
eventBroadcaster.on('envelope', onMessage);
|
|
45
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,iDAAsE;AACtE,
|
|
1
|
+
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAC1C,iDAAsE;AACtE,kDAAyD;AACzD,4CAAyE;AAGzE,mCAAsC;AACtC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,+CAAgD;AAChD,uCAAuD;AACvD,uCAA6C;AAC7C,qDAAgD;AAEhD;;;;;;;GAOG;AACI,KAAK,UAAU,WAAW,CAC/B,aAA0B,EAC1B,cAA+B,EAAE,EACjC,SAAuC;IAEvC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACzE,MAAM,MAAM,GAAY,IAAI,8BAAa,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAExD,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,OAAO,IAAI,aAAa,CAAC,OAAO;QAC9B,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,mBAAmB;QAC3C,CAAC,CAAC,aAAa,CAAC,OAAO,CAAA;IAE3B,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,GACvE,MAAM,IAAA,oBAAY,EAAC,MAAM,EAAE,GAAG,EAAE,aAAa,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAA;IAE5E,MAAM,k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AO,EAAE,OAAO,IAAI,CAAC,oBAAoB;QACzC,OAAO,EAAE,kBAAkB;KAC5B,CAAA;AACH,CAAC;AA7GD,kCA6GC","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 { ILogger } from '../logger'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { resolvePaths } from './paths'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\nimport { initializePlugins } from './plugins'\nimport { ConsoleLogger } from './console_logger'\n\n/**\n * Execute a Cucumber test run.\n *\n * @public\n * @param configuration - Configuration loaded from `loadConfiguration`.\n * @param environment - Project environment.\n * @param onMessage - Callback fired each time Cucumber emits a message.\n */\nexport async function runCucumber(\n configuration: IRunOptions,\n environment: IRunEnvironment = {},\n onMessage?: (message: Envelope) => void\n): Promise<IRunResult> {\n const { cwd, stdout, stderr, env, debug } = mergeEnvironment(environment)\n const logger: ILogger = new ConsoleLogger(stderr, debug)\n\n const newId = IdGenerator.uuid()\n\n const supportCoordinates =\n 'World' in configuration.support\n ? configuration.support.originalCoordinates\n : configuration.support\n\n const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } =\n await resolvePaths(logger, cwd, configuration.sources, supportCoordinates)\n\n const supportCodeLibrary =\n 'World' in configuration.support\n ? configuration.support\n : await getSupportCodeLibrary({\n cwd,\n newId,\n requirePaths,\n importPaths,\n requireModules: supportCoordinates.requireModules,\n })\n\n const plugins = await initializePlugins(logger, configuration, environment)\n\n const eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n eventBroadcaster.on('envelope', (value) => plugins.emit('message', value))\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: configuration.formats,\n supportCodeLibrary,\n })\n await emitMetaMessage(eventBroadcaster, env)\n\n let pickleIds: string[] = []\n let parseErrors: ParseError[] = []\n if (featurePaths.length > 0) {\n const gherkinResult = await getFilteredPicklesAndErrors({\n newId,\n cwd,\n logger,\n unexpandedFeaturePaths,\n featurePaths,\n coordinates: configuration.sources,\n onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),\n })\n pickleIds = gherkinResult.filteredPickles.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 plugins.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 requireModules: supportCoordinates.requireModules,\n requirePaths,\n importPaths,\n options: configuration.runtime,\n })\n const success = await runtime.start()\n await cleanupFormatters()\n await plugins.cleanup()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
|
package/lib/api/runtime.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'node:events';
|
|
3
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
2
4
|
import { IRuntime } from '../runtime';
|
|
3
|
-
import { EventEmitter } from 'events';
|
|
4
5
|
import { EventDataCollector } from '../formatter/helpers';
|
|
5
|
-
import { IdGenerator } from '@cucumber/messages';
|
|
6
6
|
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
|
-
import { IRunOptionsRuntime } from './types';
|
|
8
7
|
import { ILogger } from '../logger';
|
|
8
|
+
import { IRunOptionsRuntime } from './types';
|
|
9
9
|
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
|
|
10
10
|
cwd: string;
|
|
11
11
|
logger: ILogger;
|
package/lib/api/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;
|
|
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,cAAc,EACd,YAAY,EACZ,WAAW,EACX,OAAO,EAAE,EAAE,QAAQ,EAAE,GAAG,OAAO,EAAE,GAalC;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,cAAc;YACd,YAAY;YACZ,WAAW;YACX,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;AAjDD,kCAiDC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport Runtime, { IRuntime } from '../runtime'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { ISupportCodeLibrary } 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 requireModules,\n requirePaths,\n importPaths,\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: ISupportCodeLibrary\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\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 requireModules,\n requirePaths,\n importPaths,\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.js
CHANGED
|
@@ -4,11 +4,9 @@ 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_url_1 = require("node:url");
|
|
7
8
|
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
|
|
8
|
-
const url_1 = require("url");
|
|
9
9
|
const try_require_1 = __importDefault(require("../try_require"));
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
-
const { importer } = require('../importer');
|
|
12
10
|
async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }) {
|
|
13
11
|
support_code_library_builder_1.default.reset(cwd, newId, {
|
|
14
12
|
requireModules,
|
|
@@ -18,7 +16,7 @@ async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths,
|
|
|
18
16
|
requireModules.map((module) => (0, try_require_1.default)(module));
|
|
19
17
|
requirePaths.map((path) => (0, try_require_1.default)(path));
|
|
20
18
|
for (const path of importPaths) {
|
|
21
|
-
await
|
|
19
|
+
await import((0, node_url_1.pathToFileURL)(path).toString());
|
|
22
20
|
}
|
|
23
21
|
return support_code_library_builder_1.default.finalize();
|
|
24
22
|
}
|
package/lib/api/support.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAwC;AAGxC,mGAAuE;AACvE,iEAAuC;AAEhC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE;QAC1C,cAAc;QACd,YAAY;QACZ,WAAW;KACZ,CAAC,CAAA;IAEF,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,CAAA;IAClD,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,CAAA;IAE5C,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,MAAM,CAAC,IAAA,wBAAa,EAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAA;KAC7C;IAED,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AA3BD,sDA2BC","sourcesContent":["import { pathToFileURL } from 'node:url'\nimport { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport tryRequire from '../try_require'\n\nexport async function getSupportCodeLibrary({\n cwd,\n newId,\n requireModules,\n requirePaths,\n importPaths,\n}: {\n cwd: string\n newId: IdGenerator.NewId\n requireModules: string[]\n requirePaths: string[]\n importPaths: string[]\n}): Promise<ISupportCodeLibrary> {\n supportCodeLibraryBuilder.reset(cwd, newId, {\n requireModules,\n requirePaths,\n importPaths,\n })\n\n requireModules.map((module) => tryRequire(module))\n requirePaths.map((path) => tryRequire(path))\n\n for (const path of importPaths) {\n await import(pathToFileURL(path).toString())\n }\n\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
|