@cucumber/cucumber 8.0.0-rc.1 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +83 -51
- package/api/index.d.ts +6 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +65 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +13 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +16 -0
- package/lib/api/formatters.js +72 -0
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +65 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +11 -0
- package/lib/api/index.js +28 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +32 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +28 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +7 -0
- package/lib/api/paths.js +99 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +108 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +20 -0
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/support.d.ts +9 -0
- package/lib/api/support.js +21 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/types.d.ts +168 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +16 -10
- package/lib/cli/helpers.js +54 -38
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/i18n.js +1 -1
- package/lib/cli/i18n.js.map +1 -1
- package/lib/cli/index.d.ts +6 -23
- package/lib/cli/index.js +38 -195
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/install_validator.js +1 -1
- package/lib/cli/install_validator.js.map +1 -1
- package/lib/cli/publish_banner.js +6 -6
- package/lib/cli/publish_banner.js.map +1 -1
- package/lib/cli/run.js +15 -7
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.d.ts +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/{cli → configuration}/argv_parser.js +47 -44
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +27 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +2 -0
- package/lib/configuration/from_file.js +68 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +7 -0
- package/lib/configuration/index.js +29 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +19 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/{cli → configuration}/option_splitter.js +4 -3
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +25 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +2 -0
- package/lib/configuration/validate_configuration.js +10 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/formatter/builder.d.ts +3 -3
- package/lib/formatter/builder.js +34 -8
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.js +15 -16
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.js +15 -11
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/gherkin_document_parser.js +6 -6
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -1
- package/lib/formatter/helpers/index.js +5 -1
- package/lib/formatter/helpers/index.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.d.ts +2 -2
- package/lib/formatter/helpers/issue_helpers.js +4 -4
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/keyword_type.js +1 -1
- package/lib/formatter/helpers/keyword_type.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -1
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js +1 -1
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.js +6 -2
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +2 -2
- package/lib/formatter/helpers/test_case_attempt_formatter.js +24 -19
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -2
- package/lib/formatter/helpers/test_case_attempt_parser.js +19 -15
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.d.ts +1 -2
- package/lib/formatter/helpers/usage_helpers/index.js +13 -9
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.js +4 -4
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/http_stream.js +6 -6
- package/lib/formatter/http_stream.js.map +1 -1
- package/lib/formatter/index.d.ts +14 -2
- package/lib/formatter/index.js +2 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.js +18 -14
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.js +16 -16
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.js +7 -3
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/publish.d.ts +1 -0
- package/lib/formatter/publish.js +5 -0
- package/lib/formatter/publish.js.map +1 -0
- package/lib/formatter/rerun_formatter.js +10 -6
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +7 -4
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.js +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/summary_formatter.js +9 -9
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +11 -8
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +2 -3
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +5 -0
- package/lib/index.js +13 -2
- package/lib/index.js.map +1 -1
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/models/step_definition.js +3 -3
- package/lib/models/step_definition.js.map +1 -1
- package/lib/pickle_filter.js +8 -8
- package/lib/pickle_filter.js.map +1 -1
- package/lib/runtime/assemble_test_cases.js +1 -1
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.js +9 -5
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/helpers.js +11 -4
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +7 -5
- package/lib/runtime/index.js +8 -27
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/command_types.d.ts +3 -2
- package/lib/runtime/parallel/command_types.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +32 -11
- package/lib/runtime/parallel/coordinator.js +80 -28
- 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.d.ts +2 -4
- package/lib/runtime/parallel/worker.js +14 -37
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/runtime/step_runner.js +9 -5
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +9 -5
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.js +11 -7
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/stack_trace_filter.js +2 -2
- package/lib/stack_trace_filter.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/{build_helpers.d.ts → build_parameter_type.d.ts} +0 -2
- package/lib/support_code_library_builder/build_parameter_type.js +13 -0
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +30 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +4 -2
- package/lib/support_code_library_builder/index.js +43 -19
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +9 -0
- package/lib/support_code_library_builder/types.js.map +1 -1
- package/lib/time.js +5 -1
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +4 -4
- package/lib/user_code_runner.js.map +1 -1
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +5 -1
- package/package.json +72 -49
- package/lib/cli/argv_parser.d.ts +0 -50
- package/lib/cli/argv_parser.js.map +0 -1
- package/lib/cli/configuration_builder.d.ts +0 -45
- package/lib/cli/configuration_builder.js +0 -159
- package/lib/cli/configuration_builder.js.map +0 -1
- package/lib/cli/option_splitter.d.ts +0 -4
- package/lib/cli/option_splitter.js.map +0 -1
- package/lib/cli/profile_loader.d.ts +0 -7
- package/lib/cli/profile_loader.js +0 -49
- package/lib/cli/profile_loader.js.map +0 -1
- package/lib/support_code_library_builder/build_helpers.js +0 -45
- package/lib/support_code_library_builder/build_helpers.js.map +0 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadSources = void 0;
|
|
4
|
+
const paths_1 = require("./paths");
|
|
5
|
+
const messages_1 = require("@cucumber/messages");
|
|
6
|
+
const console_1 = require("console");
|
|
7
|
+
const environment_1 = require("./environment");
|
|
8
|
+
const gherkin_1 = require("./gherkin");
|
|
9
|
+
/**
|
|
10
|
+
* Load and parse features, produce a filtered and ordered test plan and/or parse errors.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @param coordinates - Coordinates required to find features
|
|
14
|
+
* @param environment - Project environment.
|
|
15
|
+
*/
|
|
16
|
+
async function loadSources(coordinates, environment = {}) {
|
|
17
|
+
const { cwd, stderr } = (0, environment_1.mergeEnvironment)(environment);
|
|
18
|
+
const logger = new console_1.Console(stderr);
|
|
19
|
+
const newId = messages_1.IdGenerator.uuid();
|
|
20
|
+
const { unexpandedFeaturePaths, featurePaths } = await (0, paths_1.resolvePaths)(cwd, coordinates);
|
|
21
|
+
if (featurePaths.length === 0) {
|
|
22
|
+
return {
|
|
23
|
+
plan: [],
|
|
24
|
+
errors: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const { filteredPickles, parseErrors } = await (0, gherkin_1.getFilteredPicklesAndErrors)({
|
|
28
|
+
newId,
|
|
29
|
+
cwd,
|
|
30
|
+
logger,
|
|
31
|
+
unexpandedFeaturePaths,
|
|
32
|
+
featurePaths,
|
|
33
|
+
coordinates,
|
|
34
|
+
});
|
|
35
|
+
const plan = filteredPickles.map(({ location, pickle }) => ({
|
|
36
|
+
name: pickle.name,
|
|
37
|
+
uri: pickle.uri,
|
|
38
|
+
location,
|
|
39
|
+
}));
|
|
40
|
+
const errors = parseErrors.map(({ source, message }) => {
|
|
41
|
+
return {
|
|
42
|
+
uri: source.uri,
|
|
43
|
+
location: source.location,
|
|
44
|
+
message,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
plan,
|
|
49
|
+
errors,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
exports.loadSources = loadSources;
|
|
53
|
+
//# sourceMappingURL=load_sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_sources.js","sourceRoot":"","sources":["../../src/api/load_sources.ts"],"names":[],"mappings":";;;AAOA,mCAAsC;AACtC,iDAAgD;AAChD,qCAAiC;AACjC,+CAAgD;AAChD,uCAAuD;AAEvD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,WAAgC,EAChC,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IACrD,MAAM,MAAM,GAAG,IAAI,iBAAO,CAAC,MAAM,CAAC,CAAA;IAClC,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,oBAAY,EACjE,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;AA3CD,kCA2CC","sourcesContent":["import {\n ILoadSourcesResult,\n IPlannedPickle,\n IRunEnvironment,\n ISourcesCoordinates,\n ISourcesError,\n} from './types'\nimport { resolvePaths } from './paths'\nimport { IdGenerator } from '@cucumber/messages'\nimport { Console } from 'console'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\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 } = mergeEnvironment(environment)\n const logger = new Console(stderr)\n const newId = IdGenerator.uuid()\n const { unexpandedFeaturePaths, featurePaths } = await resolvePaths(\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"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ILoadSupportOptions, IRunEnvironment } from './types';
|
|
2
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
|
+
/**
|
|
4
|
+
* Load support code for use in test runs.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @param options - Subset of `IRunnableConfiguration` required to find the support code.
|
|
8
|
+
* @param environment - Project environment.
|
|
9
|
+
*/
|
|
10
|
+
export declare function loadSupport(options: ILoadSupportOptions, environment?: IRunEnvironment): Promise<ISupportCodeLibrary>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadSupport = void 0;
|
|
4
|
+
const messages_1 = require("@cucumber/messages");
|
|
5
|
+
const paths_1 = require("./paths");
|
|
6
|
+
const support_1 = require("./support");
|
|
7
|
+
const environment_1 = require("./environment");
|
|
8
|
+
/**
|
|
9
|
+
* Load support code for use in test runs.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
* @param options - Subset of `IRunnableConfiguration` required to find the support code.
|
|
13
|
+
* @param environment - Project environment.
|
|
14
|
+
*/
|
|
15
|
+
async function loadSupport(options, environment = {}) {
|
|
16
|
+
const { cwd } = (0, environment_1.mergeEnvironment)(environment);
|
|
17
|
+
const newId = messages_1.IdGenerator.uuid();
|
|
18
|
+
const { requirePaths, importPaths } = await (0, paths_1.resolvePaths)(cwd, options.sources, options.support);
|
|
19
|
+
return await (0, support_1.getSupportCodeLibrary)({
|
|
20
|
+
cwd,
|
|
21
|
+
newId,
|
|
22
|
+
requireModules: options.support.requireModules,
|
|
23
|
+
requirePaths,
|
|
24
|
+
importPaths,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
exports.loadSupport = loadSupport;
|
|
28
|
+
//# sourceMappingURL=load_support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_support.js","sourceRoot":"","sources":["../../src/api/load_support.ts"],"names":[],"mappings":";;;AAAA,iDAAgD;AAEhD,mCAAsC;AACtC,uCAAiD;AACjD,+CAAgD;AAGhD;;;;;;GAMG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA4B,EAC5B,cAA+B,EAAE;IAEjC,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAC7C,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAChC,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,IAAA,oBAAY,EACtD,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;AAlBD,kCAkBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ILoadSupportOptions, IRunEnvironment } from './types'\nimport { resolvePaths } from './paths'\nimport { getSupportCodeLibrary } from './support'\nimport { mergeEnvironment } from './environment'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\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 } = mergeEnvironment(environment)\n const newId = IdGenerator.uuid()\n const { requirePaths, importPaths } = await resolvePaths(\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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ISourcesCoordinates, ISupportCodeCoordinates } from './types';
|
|
2
|
+
export declare function resolvePaths(cwd: string, sources: Pick<ISourcesCoordinates, 'paths'>, support?: ISupportCodeCoordinates): Promise<{
|
|
3
|
+
unexpandedFeaturePaths: string[];
|
|
4
|
+
featurePaths: string[];
|
|
5
|
+
requirePaths: string[];
|
|
6
|
+
importPaths: string[];
|
|
7
|
+
}>;
|
package/lib/api/paths.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolvePaths = void 0;
|
|
7
|
+
const util_1 = require("util");
|
|
8
|
+
const glob_1 = __importDefault(require("glob"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
const fs_1 = __importDefault(require("mz/fs"));
|
|
11
|
+
async function resolvePaths(cwd, sources, support = {
|
|
12
|
+
requireModules: [],
|
|
13
|
+
requirePaths: [],
|
|
14
|
+
importPaths: [],
|
|
15
|
+
}) {
|
|
16
|
+
const unexpandedFeaturePaths = await getUnexpandedFeaturePaths(cwd, sources.paths);
|
|
17
|
+
const featurePaths = await expandFeaturePaths(cwd, unexpandedFeaturePaths);
|
|
18
|
+
const { requirePaths, importPaths } = await deriveSupportPaths(cwd, featurePaths, support.requirePaths, support.importPaths);
|
|
19
|
+
return {
|
|
20
|
+
unexpandedFeaturePaths,
|
|
21
|
+
featurePaths,
|
|
22
|
+
requirePaths,
|
|
23
|
+
importPaths,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.resolvePaths = resolvePaths;
|
|
27
|
+
async function expandPaths(cwd, unexpandedPaths, defaultExtension) {
|
|
28
|
+
const expandedPaths = await Promise.all(unexpandedPaths.map(async (unexpandedPath) => {
|
|
29
|
+
const matches = await (0, util_1.promisify)(glob_1.default)(unexpandedPath, {
|
|
30
|
+
absolute: true,
|
|
31
|
+
cwd,
|
|
32
|
+
});
|
|
33
|
+
const expanded = await Promise.all(matches.map(async (match) => {
|
|
34
|
+
if (path_1.default.extname(match) === '') {
|
|
35
|
+
return await (0, util_1.promisify)(glob_1.default)(`${match}/**/*${defaultExtension}`);
|
|
36
|
+
}
|
|
37
|
+
return [match];
|
|
38
|
+
}));
|
|
39
|
+
return expanded.flat();
|
|
40
|
+
}));
|
|
41
|
+
return expandedPaths.flat().map((x) => path_1.default.normalize(x));
|
|
42
|
+
}
|
|
43
|
+
async function getUnexpandedFeaturePaths(cwd, args) {
|
|
44
|
+
if (args.length > 0) {
|
|
45
|
+
const nestedFeaturePaths = await Promise.all(args.map(async (arg) => {
|
|
46
|
+
const filename = path_1.default.basename(arg);
|
|
47
|
+
if (filename[0] === '@') {
|
|
48
|
+
const filePath = path_1.default.join(cwd, arg);
|
|
49
|
+
const content = await fs_1.default.readFile(filePath, 'utf8');
|
|
50
|
+
return content.split('\n').map((x) => x.trim());
|
|
51
|
+
}
|
|
52
|
+
return [arg];
|
|
53
|
+
}));
|
|
54
|
+
const featurePaths = nestedFeaturePaths.flat();
|
|
55
|
+
if (featurePaths.length > 0) {
|
|
56
|
+
return featurePaths.filter((x) => x !== '');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return ['features/**/*.{feature,feature.md}'];
|
|
60
|
+
}
|
|
61
|
+
function getFeatureDirectoryPaths(cwd, featurePaths) {
|
|
62
|
+
const featureDirs = featurePaths.map((featurePath) => {
|
|
63
|
+
let featureDir = path_1.default.dirname(featurePath);
|
|
64
|
+
let childDir;
|
|
65
|
+
let parentDir = featureDir;
|
|
66
|
+
while (childDir !== parentDir) {
|
|
67
|
+
childDir = parentDir;
|
|
68
|
+
parentDir = path_1.default.dirname(childDir);
|
|
69
|
+
if (path_1.default.basename(parentDir) === 'features') {
|
|
70
|
+
featureDir = parentDir;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return path_1.default.relative(cwd, featureDir);
|
|
75
|
+
});
|
|
76
|
+
return [...new Set(featureDirs)];
|
|
77
|
+
}
|
|
78
|
+
async function expandFeaturePaths(cwd, featurePaths) {
|
|
79
|
+
featurePaths = featurePaths.map((p) => p.replace(/(:\d+)*$/g, '')); // Strip line numbers
|
|
80
|
+
featurePaths = [...new Set(featurePaths)]; // Deduplicate the feature files
|
|
81
|
+
return await expandPaths(cwd, featurePaths, '.feature');
|
|
82
|
+
}
|
|
83
|
+
async function deriveSupportPaths(cwd, featurePaths, unexpandedRequirePaths, unexpandedImportPaths) {
|
|
84
|
+
if (unexpandedRequirePaths.length === 0 &&
|
|
85
|
+
unexpandedImportPaths.length === 0) {
|
|
86
|
+
const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths);
|
|
87
|
+
const requirePaths = await expandPaths(cwd, defaultPaths, '.js');
|
|
88
|
+
const importPaths = await expandPaths(cwd, defaultPaths, '.mjs');
|
|
89
|
+
return { requirePaths, importPaths };
|
|
90
|
+
}
|
|
91
|
+
const requirePaths = unexpandedRequirePaths.length > 0
|
|
92
|
+
? await expandPaths(cwd, unexpandedRequirePaths, '.js')
|
|
93
|
+
: [];
|
|
94
|
+
const importPaths = unexpandedImportPaths.length > 0
|
|
95
|
+
? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')
|
|
96
|
+
: [];
|
|
97
|
+
return { requirePaths, importPaths };
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/api/paths.ts"],"names":[],"mappings":";;;;;;AAAA,+BAAgC;AAChC,gDAAuB;AACvB,gDAAuB;AACvB,+CAAsB;AAGf,KAAK,UAAU,YAAY,CAChC,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,sBAAsB,CACvB,CAAA;IACD,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,MAAM,kBAAkB,CAC5D,GAAG,EACH,YAAY,EACZ,OAAO,CAAC,YAAY,EACpB,OAAO,CAAC,WAAW,CACpB,CAAA;IACD,OAAO;QACL,sBAAsB;QACtB,YAAY;QACZ,YAAY;QACZ,WAAW;KACZ,CAAA;AACH,CAAC;AAlCD,oCAkCC;AAED,KAAK,UAAU,WAAW,CACxB,GAAW,EACX,eAAyB,EACzB,gBAAwB;IAExB,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,eAAe,CAAC,GAAG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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,CAAA,CAAC,qBAAqB;IACxF,YAAY,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAA,CAAC,gCAAgC;IAC1E,OAAO,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AACzD,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,GAAW,EACX,YAAsB,EACtB,sBAAgC,EAChC,qBAA+B;IAK/B,IACE,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACnC,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAClC;QACA,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChE,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;QAChE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;QAChE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;KACrC;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 { promisify } from 'util'\nimport glob from 'glob'\nimport path from 'path'\nimport fs from 'mz/fs'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from './types'\n\nexport async function resolvePaths(\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 const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n featurePaths,\n support.requirePaths,\n support.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 promisify(glob)(unexpandedPath, {\n absolute: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return await promisify(glob)(`${match}/**/*${defaultExtension}`)\n }\n return [match]\n })\n )\n return expanded.flat()\n })\n )\n return expandedPaths.flat().map((x) => path.normalize(x))\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 featurePaths = [...new Set(featurePaths)] // Deduplicate the feature files\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 requirePaths = await expandPaths(cwd, defaultPaths, '.js')\n const importPaths = await expandPaths(cwd, defaultPaths, '.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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Envelope } from '@cucumber/messages';
|
|
2
|
+
import { IRunOptions, IRunEnvironment, IRunResult } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Execute a Cucumber test run.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
* @param configuration - Configuration loaded from `loadConfiguration`.
|
|
8
|
+
* @param environment - Project environment.
|
|
9
|
+
* @param onMessage - Callback fired each time Cucumber emits a message.
|
|
10
|
+
*/
|
|
11
|
+
export declare function runCucumber(configuration: IRunOptions, environment?: IRunEnvironment, onMessage?: (message: Envelope) => void): Promise<IRunResult>;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runCucumber = void 0;
|
|
4
|
+
const messages_1 = require("@cucumber/messages");
|
|
5
|
+
const events_1 = require("events");
|
|
6
|
+
const helpers_1 = require("../formatter/helpers");
|
|
7
|
+
const helpers_2 = require("../cli/helpers");
|
|
8
|
+
const paths_1 = require("./paths");
|
|
9
|
+
const runtime_1 = require("./runtime");
|
|
10
|
+
const formatters_1 = require("./formatters");
|
|
11
|
+
const support_1 = require("./support");
|
|
12
|
+
const console_1 = require("console");
|
|
13
|
+
const environment_1 = require("./environment");
|
|
14
|
+
const gherkin_1 = require("./gherkin");
|
|
15
|
+
/**
|
|
16
|
+
* Execute a Cucumber test run.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
* @param configuration - Configuration loaded from `loadConfiguration`.
|
|
20
|
+
* @param environment - Project environment.
|
|
21
|
+
* @param onMessage - Callback fired each time Cucumber emits a message.
|
|
22
|
+
*/
|
|
23
|
+
async function runCucumber(configuration, environment = {}, onMessage) {
|
|
24
|
+
const { cwd, stdout, stderr, env } = (0, environment_1.mergeEnvironment)(environment);
|
|
25
|
+
const logger = new console_1.Console(stdout, stderr);
|
|
26
|
+
const newId = messages_1.IdGenerator.uuid();
|
|
27
|
+
const supportCoordinates = 'World' in configuration.support
|
|
28
|
+
? configuration.support.originalCoordinates
|
|
29
|
+
: configuration.support;
|
|
30
|
+
const { unexpandedFeaturePaths, featurePaths, requirePaths, importPaths } = await (0, paths_1.resolvePaths)(cwd, configuration.sources, supportCoordinates);
|
|
31
|
+
const supportCodeLibrary = 'World' in configuration.support
|
|
32
|
+
? configuration.support
|
|
33
|
+
: await (0, support_1.getSupportCodeLibrary)({
|
|
34
|
+
cwd,
|
|
35
|
+
newId,
|
|
36
|
+
requirePaths,
|
|
37
|
+
importPaths,
|
|
38
|
+
requireModules: supportCoordinates.requireModules,
|
|
39
|
+
});
|
|
40
|
+
const eventBroadcaster = new events_1.EventEmitter();
|
|
41
|
+
if (onMessage) {
|
|
42
|
+
eventBroadcaster.on('envelope', onMessage);
|
|
43
|
+
}
|
|
44
|
+
const eventDataCollector = new helpers_1.EventDataCollector(eventBroadcaster);
|
|
45
|
+
let formatterStreamError = false;
|
|
46
|
+
const cleanup = await (0, formatters_1.initializeFormatters)({
|
|
47
|
+
cwd,
|
|
48
|
+
stdout,
|
|
49
|
+
logger,
|
|
50
|
+
onStreamError: () => (formatterStreamError = true),
|
|
51
|
+
eventBroadcaster,
|
|
52
|
+
eventDataCollector,
|
|
53
|
+
configuration: configuration.formats,
|
|
54
|
+
supportCodeLibrary,
|
|
55
|
+
});
|
|
56
|
+
await (0, helpers_2.emitMetaMessage)(eventBroadcaster, env);
|
|
57
|
+
let pickleIds = [];
|
|
58
|
+
let parseErrors = [];
|
|
59
|
+
if (featurePaths.length > 0) {
|
|
60
|
+
const gherkinResult = await (0, gherkin_1.getFilteredPicklesAndErrors)({
|
|
61
|
+
newId,
|
|
62
|
+
cwd,
|
|
63
|
+
logger,
|
|
64
|
+
unexpandedFeaturePaths,
|
|
65
|
+
featurePaths,
|
|
66
|
+
coordinates: configuration.sources,
|
|
67
|
+
onEnvelope: (envelope) => eventBroadcaster.emit('envelope', envelope),
|
|
68
|
+
});
|
|
69
|
+
pickleIds = gherkinResult.filteredPickles.map(({ pickle }) => pickle.id);
|
|
70
|
+
parseErrors = gherkinResult.parseErrors;
|
|
71
|
+
}
|
|
72
|
+
if (parseErrors.length) {
|
|
73
|
+
parseErrors.forEach((parseError) => {
|
|
74
|
+
logger.error(`Parse error in "${parseError.source.uri}" ${parseError.message}`);
|
|
75
|
+
});
|
|
76
|
+
await cleanup();
|
|
77
|
+
return {
|
|
78
|
+
success: false,
|
|
79
|
+
support: supportCodeLibrary,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
(0, helpers_2.emitSupportCodeMessages)({
|
|
83
|
+
eventBroadcaster,
|
|
84
|
+
supportCodeLibrary,
|
|
85
|
+
newId,
|
|
86
|
+
});
|
|
87
|
+
const runtime = (0, runtime_1.makeRuntime)({
|
|
88
|
+
cwd,
|
|
89
|
+
logger,
|
|
90
|
+
eventBroadcaster,
|
|
91
|
+
eventDataCollector,
|
|
92
|
+
pickleIds,
|
|
93
|
+
newId,
|
|
94
|
+
supportCodeLibrary,
|
|
95
|
+
requireModules: supportCoordinates.requireModules,
|
|
96
|
+
requirePaths,
|
|
97
|
+
importPaths,
|
|
98
|
+
options: configuration.runtime,
|
|
99
|
+
});
|
|
100
|
+
const success = await runtime.start();
|
|
101
|
+
await cleanup();
|
|
102
|
+
return {
|
|
103
|
+
success: success && !formatterStreamError,
|
|
104
|
+
support: supportCodeLibrary,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
exports.runCucumber = runCucumber;
|
|
108
|
+
//# sourceMappingURL=run_cucumber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_cucumber.js","sourceRoot":"","sources":["../../src/api/run_cucumber.ts"],"names":[],"mappings":";;;AAAA,iDAAsE;AACtE,mCAAqC;AACrC,kDAAyD;AACzD,4CAAyE;AAEzE,mCAAsC;AACtC,uCAAuC;AACvC,6CAAmD;AACnD,uCAAiD;AACjD,qCAAiC;AACjC,+CAAgD;AAChD,uCAAuD;AAEvD;;;;;;;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,GAAG,IAAA,8BAAgB,EAAC,WAAW,CAAC,CAAA;IAClE,MAAM,MAAM,GAAG,IAAI,iBAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,KAAK,GAAG,sBAAW,CAAC,IAAI,EAAE,CAAA;IAEhC,MAAM,kBAAkB,GACtB,OAAO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,kBAAkB;KAC5B,CAAA;AACH,CAAC;AArGD,kCAqGC","sourcesContent":["import { Envelope, IdGenerator, ParseError } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { emitMetaMessage, emitSupportCodeMessages } from '../cli/helpers'\nimport { IRunOptions, IRunEnvironment, IRunResult } from './types'\nimport { resolvePaths } from './paths'\nimport { makeRuntime } from './runtime'\nimport { initializeFormatters } from './formatters'\nimport { getSupportCodeLibrary } from './support'\nimport { Console } from 'console'\nimport { mergeEnvironment } from './environment'\nimport { getFilteredPicklesAndErrors } from './gherkin'\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 } = mergeEnvironment(environment)\n const logger = new Console(stdout, stderr)\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(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 eventBroadcaster = new EventEmitter()\n if (onMessage) {\n eventBroadcaster.on('envelope', onMessage)\n }\n const eventDataCollector = new EventDataCollector(eventBroadcaster)\n\n let formatterStreamError = false\n const cleanup = await initializeFormatters({\n cwd,\n stdout,\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 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 cleanup()\n\n return {\n success: success && !formatterStreamError,\n support: supportCodeLibrary,\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IRuntime } from '../runtime';
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import { EventDataCollector } from '../formatter/helpers';
|
|
5
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
6
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
|
+
import { IRunOptionsRuntime } from './types';
|
|
8
|
+
export declare function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }: {
|
|
9
|
+
cwd: string;
|
|
10
|
+
logger: Console;
|
|
11
|
+
eventBroadcaster: EventEmitter;
|
|
12
|
+
eventDataCollector: EventDataCollector;
|
|
13
|
+
newId: IdGenerator.NewId;
|
|
14
|
+
pickleIds: string[];
|
|
15
|
+
supportCodeLibrary: ISupportCodeLibrary;
|
|
16
|
+
requireModules: string[];
|
|
17
|
+
requirePaths: string[];
|
|
18
|
+
importPaths: string[];
|
|
19
|
+
options: IRunOptionsRuntime;
|
|
20
|
+
}): IRuntime;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.makeRuntime = void 0;
|
|
7
|
+
const runtime_1 = __importDefault(require("../runtime"));
|
|
8
|
+
const coordinator_1 = __importDefault(require("../runtime/parallel/coordinator"));
|
|
9
|
+
function makeRuntime({ cwd, logger, eventBroadcaster, eventDataCollector, pickleIds, newId, supportCodeLibrary, requireModules, requirePaths, importPaths, options: { parallel, ...options }, }) {
|
|
10
|
+
if (parallel > 0) {
|
|
11
|
+
return new coordinator_1.default({
|
|
12
|
+
cwd,
|
|
13
|
+
logger,
|
|
14
|
+
eventBroadcaster,
|
|
15
|
+
eventDataCollector,
|
|
16
|
+
pickleIds,
|
|
17
|
+
options,
|
|
18
|
+
newId,
|
|
19
|
+
supportCodeLibrary,
|
|
20
|
+
requireModules,
|
|
21
|
+
requirePaths,
|
|
22
|
+
importPaths,
|
|
23
|
+
numberOfWorkers: parallel,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return new runtime_1.default({
|
|
27
|
+
eventBroadcaster,
|
|
28
|
+
eventDataCollector,
|
|
29
|
+
newId,
|
|
30
|
+
pickleIds,
|
|
31
|
+
supportCodeLibrary,
|
|
32
|
+
options,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.makeRuntime = makeRuntime;
|
|
36
|
+
//# sourceMappingURL=runtime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../src/api/runtime.ts"],"names":[],"mappings":";;;;;;AAAA,yDAA8C;AAK9C,kFAAyD;AAGzD,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 Runtime, { IRuntime } from '../runtime'\nimport { EventEmitter } from 'events'\nimport { EventDataCollector } from '../formatter/helpers'\nimport { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Coordinator from '../runtime/parallel/coordinator'\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: Console\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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
2
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
|
+
export declare function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
newId: IdGenerator.NewId;
|
|
6
|
+
requireModules: string[];
|
|
7
|
+
requirePaths: string[];
|
|
8
|
+
importPaths: string[];
|
|
9
|
+
}): Promise<ISupportCodeLibrary>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getSupportCodeLibrary = void 0;
|
|
7
|
+
const support_code_library_builder_1 = __importDefault(require("../support_code_library_builder"));
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
10
|
+
const { importer } = require('../importer');
|
|
11
|
+
async function getSupportCodeLibrary({ cwd, newId, requireModules, requirePaths, importPaths, }) {
|
|
12
|
+
support_code_library_builder_1.default.reset(cwd, newId);
|
|
13
|
+
requireModules.map((module) => require(module));
|
|
14
|
+
requirePaths.map((path) => require(path));
|
|
15
|
+
for (const path of importPaths) {
|
|
16
|
+
await importer((0, url_1.pathToFileURL)(path));
|
|
17
|
+
}
|
|
18
|
+
return support_code_library_builder_1.default.finalize();
|
|
19
|
+
}
|
|
20
|
+
exports.getSupportCodeLibrary = getSupportCodeLibrary;
|
|
21
|
+
//# sourceMappingURL=support.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/api/support.ts"],"names":[],"mappings":";;;;;;AAEA,mGAAuE;AACvE,6BAAmC;AAEnC,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAEpC,KAAK,UAAU,qBAAqB,CAAC,EAC1C,GAAG,EACH,KAAK,EACL,cAAc,EACd,YAAY,EACZ,WAAW,GAOZ;IACC,sCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IAC3C,cAAc,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAA;IAC/C,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;IACzC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE;QAC9B,MAAM,QAAQ,CAAC,IAAA,mBAAa,EAAC,IAAI,CAAC,CAAC,CAAA;KACpC;IACD,OAAO,sCAAyB,CAAC,QAAQ,EAAE,CAAA;AAC7C,CAAC;AApBD,sDAoBC","sourcesContent":["import { IdGenerator } from '@cucumber/messages'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport supportCodeLibraryBuilder from '../support_code_library_builder'\nimport { pathToFileURL } from 'url'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\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.map((module) => require(module))\n requirePaths.map((path) => require(path))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n return supportCodeLibraryBuilder.finalize()\n}\n"]}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
3
|
+
import { FormatOptions, IFormatterStream } from '../formatter';
|
|
4
|
+
import { PickleOrder } from '../models/pickle_order';
|
|
5
|
+
import { IRuntimeOptions } from '../runtime';
|
|
6
|
+
import { IConfiguration } from '../configuration';
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface ILoadConfigurationOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Path to load configuration file from (defaults to `cucumber.(js|cjs|mjs|json)` if omitted).
|
|
13
|
+
*/
|
|
14
|
+
file?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Zero or more profile names from which to source configuration (if omitted or empty, the `default` profile will be used).
|
|
17
|
+
*/
|
|
18
|
+
profiles?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Ad-hoc configuration options to be applied over the top of whatever is loaded from the configuration file/profiles.
|
|
21
|
+
*/
|
|
22
|
+
provided?: Partial<IConfiguration>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export interface IResolvedConfiguration {
|
|
28
|
+
/**
|
|
29
|
+
* The final flat configuration object resolved from the configuration file/profiles plus any extra provided.
|
|
30
|
+
*/
|
|
31
|
+
useConfiguration: IConfiguration;
|
|
32
|
+
/**
|
|
33
|
+
* The format that can be passed into `runCucumber`.
|
|
34
|
+
*/
|
|
35
|
+
runConfiguration: IRunConfiguration;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
40
|
+
export interface ISourcesCoordinates {
|
|
41
|
+
defaultDialect: string;
|
|
42
|
+
paths: string[];
|
|
43
|
+
names: string[];
|
|
44
|
+
tagExpression: string;
|
|
45
|
+
order: PickleOrder;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* @public
|
|
49
|
+
*/
|
|
50
|
+
export interface IPlannedPickle {
|
|
51
|
+
name: string;
|
|
52
|
+
uri: string;
|
|
53
|
+
location: {
|
|
54
|
+
line: number;
|
|
55
|
+
column?: number;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @public
|
|
60
|
+
*/
|
|
61
|
+
export interface ISourcesError {
|
|
62
|
+
uri: string;
|
|
63
|
+
location: {
|
|
64
|
+
line: number;
|
|
65
|
+
column?: number;
|
|
66
|
+
};
|
|
67
|
+
message: string;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @public
|
|
71
|
+
*/
|
|
72
|
+
export interface ILoadSourcesResult {
|
|
73
|
+
plan: IPlannedPickle[];
|
|
74
|
+
errors: ISourcesError[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
export interface ISupportCodeCoordinates {
|
|
80
|
+
requireModules: string[];
|
|
81
|
+
requirePaths: string[];
|
|
82
|
+
importPaths: string[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
87
|
+
export interface ILoadSupportOptions {
|
|
88
|
+
sources: ISourcesCoordinates;
|
|
89
|
+
support: ISupportCodeCoordinates;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* @public
|
|
93
|
+
*/
|
|
94
|
+
export interface IRunOptionsRuntime extends IRuntimeOptions {
|
|
95
|
+
parallel: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export interface IRunOptionsFormats {
|
|
101
|
+
stdout: string;
|
|
102
|
+
files: Record<string, string>;
|
|
103
|
+
publish: {
|
|
104
|
+
url?: string;
|
|
105
|
+
token?: string;
|
|
106
|
+
} | false;
|
|
107
|
+
options: FormatOptions;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* @public
|
|
111
|
+
*/
|
|
112
|
+
export interface IRunConfiguration {
|
|
113
|
+
sources: ISourcesCoordinates;
|
|
114
|
+
support: ISupportCodeCoordinates;
|
|
115
|
+
runtime: IRunOptionsRuntime;
|
|
116
|
+
formats: IRunOptionsFormats;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare type ISupportCodeCoordinatesOrLibrary = ISupportCodeCoordinates | ISupportCodeLibrary;
|
|
122
|
+
/**
|
|
123
|
+
* @public
|
|
124
|
+
*/
|
|
125
|
+
export interface IRunOptions {
|
|
126
|
+
sources: ISourcesCoordinates;
|
|
127
|
+
support: ISupportCodeCoordinatesOrLibrary;
|
|
128
|
+
runtime: IRunOptionsRuntime;
|
|
129
|
+
formats: IRunOptionsFormats;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Contextual data about the project environment.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export interface IRunEnvironment {
|
|
137
|
+
/**
|
|
138
|
+
* Working directory for the project (defaults to `process.cwd()` if omitted).
|
|
139
|
+
*/
|
|
140
|
+
cwd?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Writable stream where the test run's main output is written (defaults to `process.stdout` if omitted).
|
|
143
|
+
*/
|
|
144
|
+
stdout?: IFormatterStream;
|
|
145
|
+
/**
|
|
146
|
+
* Writable stream where the test run's warning/error output is written (defaults to `process.stderr` if omitted).
|
|
147
|
+
*/
|
|
148
|
+
stderr?: IFormatterStream;
|
|
149
|
+
/**
|
|
150
|
+
* Environment variables (defaults to `process.env` if omitted).
|
|
151
|
+
*/
|
|
152
|
+
env?: NodeJS.ProcessEnv;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Result of a Cucumber test run.
|
|
156
|
+
*
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
export interface IRunResult {
|
|
160
|
+
/**
|
|
161
|
+
* Whether the test run was overall successful i.e. no failed scenarios. The exact meaning can vary based on the `strict` configuration option.
|
|
162
|
+
*/
|
|
163
|
+
success: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* The support code library that was used in the test run; can be reused in subsequent `runCucumber` calls.
|
|
166
|
+
*/
|
|
167
|
+
support: ISupportCodeLibrary;
|
|
168
|
+
}
|
package/lib/api/types.js
ADDED