@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 @@
|
|
|
1
|
+
export declare function locateFile(cwd: string): string | undefined;
|
|
@@ -0,0 +1,19 @@
|
|
|
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.locateFile = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("mz/fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const DEFAULT_FILENAMES = [
|
|
10
|
+
'cucumber.js',
|
|
11
|
+
'cucumber.cjs',
|
|
12
|
+
'cucumber.mjs',
|
|
13
|
+
'cucumber.json',
|
|
14
|
+
];
|
|
15
|
+
function locateFile(cwd) {
|
|
16
|
+
return DEFAULT_FILENAMES.find((filename) => fs_1.default.existsSync(path_1.default.join(cwd, filename)));
|
|
17
|
+
}
|
|
18
|
+
exports.locateFile = locateFile;
|
|
19
|
+
//# sourceMappingURL=locate_file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locate_file.js","sourceRoot":"","sources":["../../src/configuration/locate_file.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAsB;AACtB,gDAAuB;AAEvB,MAAM,iBAAiB,GAAG;IACxB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;CAChB,CAAA;AAED,SAAgB,UAAU,CAAC,GAAW;IACpC,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACzC,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CACxC,CAAA;AACH,CAAC;AAJD,gCAIC","sourcesContent":["import fs from 'mz/fs'\nimport path from 'path'\n\nconst DEFAULT_FILENAMES = [\n 'cucumber.js',\n 'cucumber.cjs',\n 'cucumber.mjs',\n 'cucumber.json',\n]\n\nexport function locateFile(cwd: string): string | undefined {\n return DEFAULT_FILENAMES.find((filename) =>\n fs.existsSync(path.join(cwd, filename))\n )\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
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.mergeConfigurations = void 0;
|
|
7
|
+
const lodash_mergewith_1 = __importDefault(require("lodash.mergewith"));
|
|
8
|
+
const ADDITIVE_ARRAYS = [
|
|
9
|
+
'format',
|
|
10
|
+
'import',
|
|
11
|
+
'name',
|
|
12
|
+
'paths',
|
|
13
|
+
'require',
|
|
14
|
+
'requireModule',
|
|
15
|
+
];
|
|
16
|
+
const TAG_EXPRESSIONS = ['tags', 'retryTagFilter'];
|
|
17
|
+
function mergeArrays(objValue, srcValue) {
|
|
18
|
+
if (objValue && srcValue) {
|
|
19
|
+
return [].concat(objValue, srcValue);
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
function mergeTagExpressions(objValue, srcValue) {
|
|
24
|
+
if (objValue && srcValue) {
|
|
25
|
+
return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
function wrapTagExpression(raw) {
|
|
30
|
+
if (raw.startsWith('(') && raw.endsWith(')')) {
|
|
31
|
+
return raw;
|
|
32
|
+
}
|
|
33
|
+
return `(${raw})`;
|
|
34
|
+
}
|
|
35
|
+
function customizer(objValue, srcValue, key) {
|
|
36
|
+
if (ADDITIVE_ARRAYS.includes(key)) {
|
|
37
|
+
return mergeArrays(objValue, srcValue);
|
|
38
|
+
}
|
|
39
|
+
if (TAG_EXPRESSIONS.includes(key)) {
|
|
40
|
+
return mergeTagExpressions(objValue, srcValue);
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
function mergeConfigurations(source, ...configurations) {
|
|
45
|
+
return (0, lodash_mergewith_1.default)({}, source, ...configurations, customizer);
|
|
46
|
+
}
|
|
47
|
+
exports.mergeConfigurations = mergeConfigurations;
|
|
48
|
+
//# sourceMappingURL=merge_configurations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge_configurations.js","sourceRoot":"","sources":["../../src/configuration/merge_configurations.ts"],"names":[],"mappings":";;;;;;AACA,wEAAwC;AAExC,MAAM,eAAe,GAAG;IACtB,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAC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import mergeWith from 'lodash.mergewith'\n\nconst ADDITIVE_ARRAYS = [\n 'format',\n 'import',\n 'name',\n 'paths',\n 'require',\n 'requireModule',\n]\nconst TAG_EXPRESSIONS = ['tags', 'retryTagFilter']\n\nfunction mergeArrays(objValue: any[], srcValue: any[]) {\n if (objValue && srcValue) {\n return [].concat(objValue, srcValue)\n }\n return undefined\n}\n\nfunction mergeTagExpressions(objValue: string, srcValue: string) {\n if (objValue && srcValue) {\n return `${wrapTagExpression(objValue)} and ${wrapTagExpression(srcValue)}`\n }\n return undefined\n}\n\nfunction wrapTagExpression(raw: string) {\n if (raw.startsWith('(') && raw.endsWith(')')) {\n return raw\n }\n return `(${raw})`\n}\n\nfunction customizer(objValue: any, srcValue: any, key: string): any {\n if (ADDITIVE_ARRAYS.includes(key)) {\n return mergeArrays(objValue, srcValue)\n }\n if (TAG_EXPRESSIONS.includes(key)) {\n return mergeTagExpressions(objValue, srcValue)\n }\n return undefined\n}\n\nexport function mergeConfigurations<T = Partial<IConfiguration>>(\n source: T,\n ...configurations: Partial<IConfiguration>[]\n): T {\n return mergeWith({}, source, ...configurations, customizer)\n}\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.OptionSplitter = void 0;
|
|
4
|
+
exports.OptionSplitter = {
|
|
4
5
|
split(option) {
|
|
5
|
-
|
|
6
|
+
option = option.replace(/"/g, '');
|
|
7
|
+
const parts = option.split(/((?:file){0}):(?!\\|\/\/)/);
|
|
6
8
|
const result = parts.reduce((memo, part, i) => {
|
|
7
9
|
if (partNeedsRecombined(i)) {
|
|
8
10
|
memo.push(parts.slice(i, i + 2).join(''));
|
|
@@ -18,5 +20,4 @@ const OptionSplitter = {
|
|
|
18
20
|
function partNeedsRecombined(i) {
|
|
19
21
|
return i % 2 === 0;
|
|
20
22
|
}
|
|
21
|
-
exports.default = OptionSplitter;
|
|
22
23
|
//# sourceMappingURL=option_splitter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"option_splitter.js","sourceRoot":"","sources":["../../src/configuration/option_splitter.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,KAAK,CAAC,MAAc;QAClB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAA;QAEjC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAA;QAEvD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAc,EAAE,IAAY,EAAE,CAAS,EAAE,EAAE;YACtE,IAAI,mBAAmB,CAAC,CAAC,CAAC,EAAE;gBAC1B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;aAC1C;YAED,OAAO,IAAI,CAAA;QACb,CAAC,EAAE,EAAE,CAAC,CAAA;QAEN,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAChB;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;AACpB,CAAC","sourcesContent":["export const OptionSplitter = {\n split(option: string): string[] {\n option = option.replace(/\"/g, '')\n\n const parts = option.split(/((?:file){0}):(?!\\\\|\\/\\/)/)\n\n const result = parts.reduce((memo: string[], part: string, i: number) => {\n if (partNeedsRecombined(i)) {\n memo.push(parts.slice(i, i + 2).join(''))\n }\n\n return memo\n }, [])\n\n if (result.length === 1) {\n result.push('')\n }\n\n return result\n },\n}\n\nfunction partNeedsRecombined(i: number): boolean {\n return i % 2 === 0\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FormatOptions } from '../formatter';
|
|
2
|
+
import { PickleOrder } from '../models/pickle_order';
|
|
3
|
+
export interface IConfiguration {
|
|
4
|
+
backtrace: boolean;
|
|
5
|
+
dryRun: boolean;
|
|
6
|
+
forceExit: boolean;
|
|
7
|
+
failFast: boolean;
|
|
8
|
+
format: string[];
|
|
9
|
+
formatOptions: FormatOptions;
|
|
10
|
+
import: string[];
|
|
11
|
+
language: string;
|
|
12
|
+
name: string[];
|
|
13
|
+
order: PickleOrder;
|
|
14
|
+
paths: string[];
|
|
15
|
+
parallel: number;
|
|
16
|
+
publish: boolean;
|
|
17
|
+
publishQuiet: boolean;
|
|
18
|
+
require: string[];
|
|
19
|
+
requireModule: string[];
|
|
20
|
+
retry: number;
|
|
21
|
+
retryTagFilter: string;
|
|
22
|
+
strict: boolean;
|
|
23
|
+
tags: string;
|
|
24
|
+
worldParameters: any;
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/configuration/types.ts"],"names":[],"mappings":"","sourcesContent":["import { FormatOptions } from '../formatter'\nimport { PickleOrder } from '../models/pickle_order'\n\nexport interface IConfiguration {\n backtrace: boolean\n dryRun: boolean\n forceExit: boolean\n failFast: boolean\n format: string[]\n formatOptions: FormatOptions\n import: string[]\n language: string\n name: string[]\n order: PickleOrder\n paths: string[]\n parallel: number\n publish: boolean\n publishQuiet: boolean\n require: string[]\n requireModule: string[]\n retry: number\n retryTagFilter: string\n strict: boolean\n tags: string\n worldParameters: any\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateConfiguration = void 0;
|
|
4
|
+
function validateConfiguration(configuration) {
|
|
5
|
+
if (configuration.retryTagFilter && !configuration.retry) {
|
|
6
|
+
throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.validateConfiguration = validateConfiguration;
|
|
10
|
+
//# sourceMappingURL=validate_configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CAAC,aAA6B;IACjE,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAND,sDAMC","sourcesContent":["import { IConfiguration } from './types'\n\nexport function validateConfiguration(configuration: IConfiguration): void {\n if (configuration.retryTagFilter && !configuration.retry) {\n throw new Error(\n 'a positive `retry` count must be specified when setting `retryTagFilter`'\n )\n }\n}\n"]}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import StepDefinitionSnippetBuilder from './step_definition_snippet_builder';
|
|
3
3
|
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
4
|
-
import Formatter, { IFormatterCleanupFn, IFormatterLogFn } from '.';
|
|
4
|
+
import Formatter, { FormatOptions, IFormatterCleanupFn, IFormatterLogFn } from '.';
|
|
5
5
|
import { EventEmitter } from 'events';
|
|
6
6
|
import EventDataCollector from './helpers/event_data_collector';
|
|
7
7
|
import { Writable as WritableStream } from 'stream';
|
|
8
|
-
import { IParsedArgvFormatOptions } from '../cli/argv_parser';
|
|
9
8
|
import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax';
|
|
10
9
|
interface IGetStepDefinitionSnippetBuilderOptions {
|
|
11
10
|
cwd: string;
|
|
@@ -18,7 +17,7 @@ export interface IBuildOptions {
|
|
|
18
17
|
eventBroadcaster: EventEmitter;
|
|
19
18
|
eventDataCollector: EventDataCollector;
|
|
20
19
|
log: IFormatterLogFn;
|
|
21
|
-
parsedArgvOptions:
|
|
20
|
+
parsedArgvOptions: FormatOptions;
|
|
22
21
|
stream: WritableStream;
|
|
23
22
|
cleanup: IFormatterCleanupFn;
|
|
24
23
|
supportCodeLibrary: ISupportCodeLibrary;
|
|
@@ -28,6 +27,7 @@ declare const FormatterBuilder: {
|
|
|
28
27
|
getConstructorByType(type: string, cwd: string): Promise<typeof Formatter>;
|
|
29
28
|
getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }: IGetStepDefinitionSnippetBuilderOptions): Promise<StepDefinitionSnippetBuilder>;
|
|
30
29
|
loadCustomClass(type: 'formatter' | 'syntax', descriptor: string, cwd: string): Promise<any>;
|
|
30
|
+
loadFile(urlOrName: URL | string): Promise<any>;
|
|
31
31
|
resolveConstructor(ImportedCode: any): any;
|
|
32
32
|
};
|
|
33
33
|
export default FormatterBuilder;
|
package/lib/formatter/builder.js
CHANGED
|
@@ -16,7 +16,7 @@ const { importer } = require('../importer');
|
|
|
16
16
|
const FormatterBuilder = {
|
|
17
17
|
async build(type, options) {
|
|
18
18
|
const FormatterConstructor = await FormatterBuilder.getConstructorByType(type, options.cwd);
|
|
19
|
-
const colorFns = get_color_fns_1.default(options.parsedArgvOptions.colorsEnabled);
|
|
19
|
+
const colorFns = (0, get_color_fns_1.default)(options.parsedArgvOptions.colorsEnabled);
|
|
20
20
|
const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder({
|
|
21
21
|
cwd: options.cwd,
|
|
22
22
|
snippetInterface: options.parsedArgvOptions.snippetInterface,
|
|
@@ -36,11 +36,11 @@ const FormatterBuilder = {
|
|
|
36
36
|
: await FormatterBuilder.loadCustomClass('formatter', type, cwd);
|
|
37
37
|
},
|
|
38
38
|
async getStepDefinitionSnippetBuilder({ cwd, snippetInterface, snippetSyntax, supportCodeLibrary, }) {
|
|
39
|
-
if (value_checker_1.doesNotHaveValue(snippetInterface)) {
|
|
39
|
+
if ((0, value_checker_1.doesNotHaveValue)(snippetInterface)) {
|
|
40
40
|
snippetInterface = snippet_syntax_1.SnippetInterface.Synchronous;
|
|
41
41
|
}
|
|
42
42
|
let Syntax = javascript_snippet_syntax_1.default;
|
|
43
|
-
if (value_checker_1.doesHaveValue(snippetSyntax)) {
|
|
43
|
+
if ((0, value_checker_1.doesHaveValue)(snippetSyntax)) {
|
|
44
44
|
Syntax = await FormatterBuilder.loadCustomClass('syntax', snippetSyntax, cwd);
|
|
45
45
|
}
|
|
46
46
|
return new step_definition_snippet_builder_1.default({
|
|
@@ -49,22 +49,48 @@ const FormatterBuilder = {
|
|
|
49
49
|
});
|
|
50
50
|
},
|
|
51
51
|
async loadCustomClass(type, descriptor, cwd) {
|
|
52
|
-
let
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
let normalised = descriptor;
|
|
53
|
+
if (descriptor.startsWith('.')) {
|
|
54
|
+
normalised = (0, url_1.pathToFileURL)(path_1.default.resolve(cwd, descriptor));
|
|
55
|
+
}
|
|
56
|
+
else if (descriptor.startsWith('file://')) {
|
|
57
|
+
normalised = new URL(descriptor);
|
|
58
|
+
}
|
|
59
|
+
let CustomClass = await FormatterBuilder.loadFile(normalised);
|
|
55
60
|
CustomClass = FormatterBuilder.resolveConstructor(CustomClass);
|
|
56
|
-
if (value_checker_1.doesHaveValue(CustomClass)) {
|
|
61
|
+
if ((0, value_checker_1.doesHaveValue)(CustomClass)) {
|
|
57
62
|
return CustomClass;
|
|
58
63
|
}
|
|
59
64
|
else {
|
|
60
65
|
throw new Error(`Custom ${type} (${descriptor}) does not export a function/class`);
|
|
61
66
|
}
|
|
62
67
|
},
|
|
68
|
+
async loadFile(urlOrName) {
|
|
69
|
+
let result;
|
|
70
|
+
try {
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
72
|
+
result = require(typeof urlOrName === 'string'
|
|
73
|
+
? urlOrName
|
|
74
|
+
: (0, url_1.fileURLToPath)(urlOrName));
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error.code === 'ERR_REQUIRE_ESM') {
|
|
78
|
+
result = await importer(urlOrName);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return result;
|
|
85
|
+
},
|
|
63
86
|
resolveConstructor(ImportedCode) {
|
|
87
|
+
if ((0, value_checker_1.doesNotHaveValue)(ImportedCode)) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
64
90
|
if (typeof ImportedCode === 'function') {
|
|
65
91
|
return ImportedCode;
|
|
66
92
|
}
|
|
67
|
-
else if (
|
|
93
|
+
else if (typeof ImportedCode === 'object' &&
|
|
68
94
|
typeof ImportedCode.default === 'function') {
|
|
69
95
|
return ImportedCode.default;
|
|
70
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,oEAAyC;AACzC,4HAAiG;AACjG,gDAAuB;AACvB,wGAA4E;
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,oEAAyC;AACzC,4HAAiG;AACjG,gDAAuB;AACvB,wGAA4E;AAO5E,oDAAkE;AAIlE,qFAAmF;AACnF,6BAAkD;AAClD,sEAA6C;AAC7C,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAAA;AAoB3C,MAAM,gBAAgB,GAAG;IACvB,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,OAAsB;QAC9C,MAAM,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,oBAAoB,CACtE,IAAI,EACJ,OAAO,CAAC,GAAG,CACZ,CAAA;QACD,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAA;QACrE,MAAM,cAAc,GAClB,MAAM,gBAAgB,CAAC,+B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,IACL,OAAO,YAAY,KAAK,QAAQ;YAChC,OAAO,YAAY,CAAC,OAAO,KAAK,UAAU,EAC1C;YACA,OAAO,YAAY,CAAC,OAAO,CAAA;SAC5B;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAA;AAED,kBAAe,gBAAgB,CAAA","sourcesContent":["import getColorFns from './get_color_fns'\nimport JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport path from 'path'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport Formatter, {\n FormatOptions,\n IFormatterCleanupFn,\n IFormatterLogFn,\n} from '.'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { EventEmitter } from 'events'\nimport EventDataCollector from './helpers/event_data_collector'\nimport { Writable as WritableStream } from 'stream'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport { fileURLToPath, pathToFileURL } from 'url'\nimport Formatters from './helpers/formatters'\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../importer')\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n cwd: string\n eventBroadcaster: EventEmitter\n eventDataCollector: EventDataCollector\n log: IFormatterLogFn\n parsedArgvOptions: FormatOptions\n stream: WritableStream\n cleanup: IFormatterCleanupFn\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nconst FormatterBuilder = {\n async build(type: string, options: IBuildOptions): Promise<Formatter> {\n const FormatterConstructor = await FormatterBuilder.getConstructorByType(\n type,\n options.cwd\n )\n const colorFns = getColorFns(options.parsedArgvOptions.colorsEnabled)\n const snippetBuilder =\n await FormatterBuilder.getStepDefinitionSnippetBuilder({\n cwd: options.cwd,\n snippetInterface: options.parsedArgvOptions.snippetInterface,\n snippetSyntax: options.parsedArgvOptions.snippetSyntax,\n supportCodeLibrary: options.supportCodeLibrary,\n })\n return new FormatterConstructor({\n colorFns,\n snippetBuilder,\n ...options,\n })\n },\n\n async getConstructorByType(\n type: string,\n cwd: string\n ): Promise<typeof Formatter> {\n const formatters: Record<string, typeof Formatter> =\n Formatters.getFormatters()\n\n return formatters[type]\n ? formatters[type]\n : await FormatterBuilder.loadCustomClass('formatter', type, cwd)\n },\n\n async getStepDefinitionSnippetBuilder({\n cwd,\n snippetInterface,\n snippetSyntax,\n supportCodeLibrary,\n }: IGetStepDefinitionSnippetBuilderOptions) {\n if (doesNotHaveValue(snippetInterface)) {\n snippetInterface = SnippetInterface.Synchronous\n }\n let Syntax = JavascriptSnippetSyntax\n if (doesHaveValue(snippetSyntax)) {\n Syntax = await FormatterBuilder.loadCustomClass(\n 'syntax',\n snippetSyntax,\n cwd\n )\n }\n return new StepDefinitionSnippetBuilder({\n snippetSyntax: new Syntax(snippetInterface),\n parameterTypeRegistry: supportCodeLibrary.parameterTypeRegistry,\n })\n },\n\n async loadCustomClass(\n type: 'formatter' | 'syntax',\n descriptor: string,\n cwd: string\n ) {\n let normalised: URL | string = descriptor\n if (descriptor.startsWith('.')) {\n normalised = pathToFileURL(path.resolve(cwd, descriptor))\n } else if (descriptor.startsWith('file://')) {\n normalised = new URL(descriptor)\n }\n let CustomClass = await FormatterBuilder.loadFile(normalised)\n CustomClass = FormatterBuilder.resolveConstructor(CustomClass)\n if (doesHaveValue(CustomClass)) {\n return CustomClass\n } else {\n throw new Error(\n `Custom ${type} (${descriptor}) does not export a function/class`\n )\n }\n },\n\n async loadFile(urlOrName: URL | string) {\n let result\n try {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n result = require(typeof urlOrName === 'string'\n ? urlOrName\n : fileURLToPath(urlOrName))\n } catch (error) {\n if (error.code === 'ERR_REQUIRE_ESM') {\n result = await importer(urlOrName)\n } else {\n throw error\n }\n }\n return result\n },\n\n resolveConstructor(ImportedCode: any) {\n if (doesNotHaveValue(ImportedCode)) {\n return null\n }\n if (typeof ImportedCode === 'function') {\n return ImportedCode\n } else if (\n typeof ImportedCode === 'object' &&\n typeof ImportedCode.default === 'function'\n ) {\n return ImportedCode.default\n }\n return null\n },\n}\n\nexport default FormatterBuilder\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../../src/formatter/fixtures/typescript.ts"],"names":[],"mappings":";;AAAA,MAAqB,SAAS;CAAG;AAAjC,4BAAiC","sourcesContent":["export default class Formatter {}\n"]}
|
|
@@ -3,33 +3,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
7
|
-
safe_1.default.enable();
|
|
6
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
7
|
function getColorFns(enabled) {
|
|
9
8
|
if (enabled) {
|
|
10
9
|
return {
|
|
11
10
|
forStatus(status) {
|
|
12
11
|
return {
|
|
13
|
-
AMBIGUOUS:
|
|
14
|
-
FAILED:
|
|
15
|
-
PASSED:
|
|
16
|
-
PENDING:
|
|
17
|
-
SKIPPED:
|
|
18
|
-
UNDEFINED:
|
|
19
|
-
UNKNOWN:
|
|
12
|
+
AMBIGUOUS: chalk_1.default.red.bind(chalk_1.default),
|
|
13
|
+
FAILED: chalk_1.default.red.bind(chalk_1.default),
|
|
14
|
+
PASSED: chalk_1.default.green.bind(chalk_1.default),
|
|
15
|
+
PENDING: chalk_1.default.yellow.bind(chalk_1.default),
|
|
16
|
+
SKIPPED: chalk_1.default.cyan.bind(chalk_1.default),
|
|
17
|
+
UNDEFINED: chalk_1.default.yellow.bind(chalk_1.default),
|
|
18
|
+
UNKNOWN: chalk_1.default.yellow.bind(chalk_1.default),
|
|
20
19
|
}[status];
|
|
21
20
|
},
|
|
22
|
-
location:
|
|
23
|
-
tag:
|
|
24
|
-
diffAdded:
|
|
25
|
-
diffRemoved:
|
|
26
|
-
errorMessage:
|
|
27
|
-
errorStack:
|
|
21
|
+
location: chalk_1.default.gray.bind(chalk_1.default),
|
|
22
|
+
tag: chalk_1.default.cyan.bind(chalk_1.default),
|
|
23
|
+
diffAdded: chalk_1.default.green.bind(chalk_1.default),
|
|
24
|
+
diffRemoved: chalk_1.default.red.bind(chalk_1.default),
|
|
25
|
+
errorMessage: chalk_1.default.red.bind(chalk_1.default),
|
|
26
|
+
errorStack: chalk_1.default.grey.bind(chalk_1.default),
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
else {
|
|
31
30
|
return {
|
|
32
|
-
forStatus(
|
|
31
|
+
forStatus(_status) {
|
|
33
32
|
return (x) => x;
|
|
34
33
|
},
|
|
35
34
|
location: (x) => x,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AAezB,SAAwB,WAAW,CAAC,OAAgB;IAClD,IAAI,OAAO,EAAE;QACX,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO;oBACL,SAAS,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBAChC,MAAM,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBAC7B,MAAM,EAAE,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC;oBAC/B,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBACjC,OAAO,EAAE,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;oBAC/B,SAAS,EAAE,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBACnC,OAAO,EAAE,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;iBAClC,CAAC,MAAM,CAAC,CAAA;YACX,CAAC;YACD,QAAQ,EAAE,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;YAChC,GAAG,EAAE,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;YAC3B,SAAS,EAAE,eAAK,CAAC,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC;YAClC,WAAW,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;YAClC,YAAY,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;YACnC,UAAU,EAAE,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;SACnC,CAAA;KACF;SAAM;QACL,OAAO;YACL,SAAS,CAAC,OAA6B;gBACrC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;YACjB,CAAC;YACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAClB,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACb,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrB,YAAY,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACrB,CAAA;KACF;AACH,CAAC;AAlCD,8BAkCC","sourcesContent":["import chalk from 'chalk'\nimport { TestStepResultStatus } from '@cucumber/messages'\n\nexport type IColorFn = (text: string) => string\n\nexport interface IColorFns {\n forStatus: (status: TestStepResultStatus) => IColorFn\n location: IColorFn\n tag: IColorFn\n diffAdded: IColorFn\n diffRemoved: IColorFn\n errorMessage: IColorFn\n errorStack: IColorFn\n}\n\nexport default function getColorFns(enabled: boolean): IColorFns {\n if (enabled) {\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: chalk.red.bind(chalk),\n FAILED: chalk.red.bind(chalk),\n PASSED: chalk.green.bind(chalk),\n PENDING: chalk.yellow.bind(chalk),\n SKIPPED: chalk.cyan.bind(chalk),\n UNDEFINED: chalk.yellow.bind(chalk),\n UNKNOWN: chalk.yellow.bind(chalk),\n }[status]\n },\n location: chalk.gray.bind(chalk),\n tag: chalk.cyan.bind(chalk),\n diffAdded: chalk.green.bind(chalk),\n diffRemoved: chalk.red.bind(chalk),\n errorMessage: chalk.red.bind(chalk),\n errorStack: chalk.grey.bind(chalk),\n }\n } else {\n return {\n forStatus(_status: TestStepResultStatus) {\n return (x) => x\n },\n location: (x) => x,\n tag: (x) => x,\n diffAdded: (x) => x,\n diffRemoved: (x) => x,\n errorMessage: (x) => x,\n errorStack: (x) => x,\n }\n }\n}\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -57,29 +61,29 @@ class EventDataCollector {
|
|
|
57
61
|
};
|
|
58
62
|
}
|
|
59
63
|
parseEnvelope(envelope) {
|
|
60
|
-
if (value_checker_1.doesHaveValue(envelope.gherkinDocument)) {
|
|
64
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.gherkinDocument)) {
|
|
61
65
|
this.gherkinDocumentMap[envelope.gherkinDocument.uri] =
|
|
62
66
|
envelope.gherkinDocument;
|
|
63
67
|
}
|
|
64
|
-
else if (value_checker_1.doesHaveValue(envelope.pickle)) {
|
|
68
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.pickle)) {
|
|
65
69
|
this.pickleMap[envelope.pickle.id] = envelope.pickle;
|
|
66
70
|
}
|
|
67
|
-
else if (value_checker_1.doesHaveValue(envelope.undefinedParameterType)) {
|
|
71
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.undefinedParameterType)) {
|
|
68
72
|
this.undefinedParameterTypes.push(envelope.undefinedParameterType);
|
|
69
73
|
}
|
|
70
|
-
else if (value_checker_1.doesHaveValue(envelope.testCase)) {
|
|
74
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testCase)) {
|
|
71
75
|
this.testCaseMap[envelope.testCase.id] = envelope.testCase;
|
|
72
76
|
}
|
|
73
|
-
else if (value_checker_1.doesHaveValue(envelope.testCaseStarted)) {
|
|
77
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseStarted)) {
|
|
74
78
|
this.initTestCaseAttempt(envelope.testCaseStarted);
|
|
75
79
|
}
|
|
76
|
-
else if (value_checker_1.doesHaveValue(envelope.attachment)) {
|
|
80
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.attachment)) {
|
|
77
81
|
this.storeAttachment(envelope.attachment);
|
|
78
82
|
}
|
|
79
|
-
else if (value_checker_1.doesHaveValue(envelope.testStepFinished)) {
|
|
83
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
|
|
80
84
|
this.storeTestStepResult(envelope.testStepFinished);
|
|
81
85
|
}
|
|
82
|
-
else if (value_checker_1.doesHaveValue(envelope.testCaseFinished)) {
|
|
86
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
|
|
83
87
|
this.storeTestCaseResult(envelope.testCaseFinished);
|
|
84
88
|
}
|
|
85
89
|
}
|
|
@@ -99,9 +103,9 @@ class EventDataCollector {
|
|
|
99
103
|
storeAttachment(attachment) {
|
|
100
104
|
const { testCaseStartedId, testStepId } = attachment;
|
|
101
105
|
// TODO: we shouldn't have to check if these properties have values - they are non-nullable
|
|
102
|
-
if (value_checker_1.doesHaveValue(testCaseStartedId) && value_checker_1.doesHaveValue(testStepId)) {
|
|
106
|
+
if ((0, value_checker_1.doesHaveValue)(testCaseStartedId) && (0, value_checker_1.doesHaveValue)(testStepId)) {
|
|
103
107
|
const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId];
|
|
104
|
-
if (value_checker_1.doesNotHaveValue(stepAttachments[testStepId])) {
|
|
108
|
+
if ((0, value_checker_1.doesNotHaveValue)(stepAttachments[testStepId])) {
|
|
105
109
|
stepAttachments[testStepId] = [];
|
|
106
110
|
}
|
|
107
111
|
stepAttachments[testStepId].push(attachment);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"event_data_collector.js","sourceRoot":"","sources":["../../../src/formatter/helpers/event_data_collector.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,uDAAqE;AAuBrE,MAAqB,kBAAkB;IAOrC,YAAY,gBAA8B;QANlC,uBAAkB,GAA6C,EAAE,CAAA;QACjE,cAAS,GAAoC,EAAE,CAAA;QAC/C,gBAAW,GAAsC,EAAE,CAAA;QACnD,2BAAsB,GAAyC,EAAE,CAAA;QAChE,4BAAuB,GAAsC,EAAE,CAAA;QAGtE,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAA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,EAAE,CAAC,EAAE;gBAClC,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO;aAC9C;SACF,CAAA;IACH,CAAC;IAED,eAAe,CAAC,UAA+B;QAC7C,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;QACpD,2FAA2F;QAC3F,IAAI,IAAA,6BAAa,EAAC,iBAAiB,CAAC,IAAI,IAAA,6BAAa,EAAC,UAAU,CAAC,EAAE;YACjE,MAAM,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAA;YAC1E,IAAI,IAAA,gCAAgB,EAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAAE;gBACjD,eAAe,CAAC,UAAU,CAAC,GAAG,EAAE,CAAA;aACjC;YACD,eAAe,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;SAC7C;IACH,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,UAAU,EACV,cAAc,GACY;QAC1B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC;YACpE,cAAc,CAAA;IAClB,CAAC;IAED,mBAAmB,CAAC,EAClB,iBAAiB,EACjB,aAAa,GACa;QAC1B,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAC/B,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAC3D,CAAA;QACD,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,mBAAmB;YAChE,QAAQ,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAA;QAC9C,IAAI,CAAC,sBAAsB,CAAC,iBAAiB,CAAC,CAAC,aAAa,GAAG,aAAa,CAAA;IAC9E,CAAC;CACF;AA5GD,qCA4GC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\nimport { EventEmitter } from 'events'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // TODO: we shouldn't have to check if these properties have values - they are non-nullable\n if (doesHaveValue(testCaseStartedId) && doesHaveValue(testStepId)) {\n const { stepAttachments } = this.testCaseAttemptDataMap[testCaseStartedId]\n if (doesNotHaveValue(stepAttachments[testStepId])) {\n stepAttachments[testStepId] = []\n }\n stepAttachments[testStepId].push(attachment)\n }\n }\n\n storeTestStepResult({\n testCaseStartedId,\n testStepId,\n testStepResult,\n }: messages.TestStepFinished): void {\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults[testStepId] =\n testStepResult\n }\n\n storeTestCaseResult({\n testCaseStartedId,\n willBeRetried,\n }: messages.TestCaseFinished): void {\n const stepResults = Object.values(\n this.testCaseAttemptDataMap[testCaseStartedId].stepResults\n )\n this.testCaseAttemptDataMap[testCaseStartedId].worstTestStepResult =\n messages.getWorstTestStepResult(stepResults)\n this.testCaseAttemptDataMap[testCaseStartedId].willBeRetried = willBeRetried\n }\n}\n"]}
|
|
@@ -12,11 +12,11 @@ function getGherkinStepMap(gherkinDocument) {
|
|
|
12
12
|
}
|
|
13
13
|
exports.getGherkinStepMap = getGherkinStepMap;
|
|
14
14
|
function extractStepContainers(child) {
|
|
15
|
-
if (value_checker_1.doesHaveValue(child.background)) {
|
|
15
|
+
if ((0, value_checker_1.doesHaveValue)(child.background)) {
|
|
16
16
|
return [child.background];
|
|
17
17
|
}
|
|
18
|
-
else if (value_checker_1.doesHaveValue(child.rule)) {
|
|
19
|
-
return child.rule.children.map((ruleChild) => value_checker_1.doesHaveValue(ruleChild.background)
|
|
18
|
+
else if ((0, value_checker_1.doesHaveValue)(child.rule)) {
|
|
19
|
+
return child.rule.children.map((ruleChild) => (0, value_checker_1.doesHaveValue)(ruleChild.background)
|
|
20
20
|
? ruleChild.background
|
|
21
21
|
: ruleChild.scenario);
|
|
22
22
|
}
|
|
@@ -26,7 +26,7 @@ function getGherkinScenarioMap(gherkinDocument) {
|
|
|
26
26
|
const result = {};
|
|
27
27
|
gherkinDocument.feature.children
|
|
28
28
|
.map((child) => {
|
|
29
|
-
if (value_checker_1.doesHaveValue(child.rule)) {
|
|
29
|
+
if ((0, value_checker_1.doesHaveValue)(child.rule)) {
|
|
30
30
|
return child.rule.children;
|
|
31
31
|
}
|
|
32
32
|
return [child];
|
|
@@ -45,7 +45,7 @@ function getGherkinExampleRuleMap(gherkinDocument) {
|
|
|
45
45
|
gherkinDocument.feature.children
|
|
46
46
|
.filter((x) => x.rule != null)
|
|
47
47
|
.forEach((x) => x.rule.children
|
|
48
|
-
.filter((child) => value_checker_1.doesHaveValue(child.scenario))
|
|
48
|
+
.filter((child) => (0, value_checker_1.doesHaveValue)(child.scenario))
|
|
49
49
|
.forEach((child) => (result[child.scenario.id] = x.rule)));
|
|
50
50
|
return result;
|
|
51
51
|
}
|
|
@@ -56,7 +56,7 @@ function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
|
56
56
|
Object.keys(scenarioMap).forEach((id) => {
|
|
57
57
|
const scenario = scenarioMap[id];
|
|
58
58
|
locationMap[id] = scenario.location;
|
|
59
|
-
if (value_checker_1.doesHaveValue(scenario.examples)) {
|
|
59
|
+
if ((0, value_checker_1.doesHaveValue)(scenario.examples)) {
|
|
60
60
|
scenario.examples.forEach((x) => x.tableBody.forEach((tableRow) => (locationMap[tableRow.id] = tableRow.location)));
|
|
61
61
|
}
|
|
62
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,eAAe,CAAC,OAAO,CAAC,QAAQ;SAC7B,GAAG,CAAC,qBAAqB,CAAC;SAC1B,IAAI,EAAE;SACN,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAmB,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CACnE,CAAA;IACH,OAAO,MAAM,CAAA;AACf,CAAC;AAXD,8CAWC;AAED,SAAS,qBAAqB,CAC5B,KAA4B;IAE5B,IAAI,6BAAa,
|
|
1
|
+
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/gherkin_document_parser.ts"],"names":[],"mappings":";;;AACA,uDAAmD;AAEnD,SAAgB,iBAAiB,CAC/B,eAAyC;IAEzC,MAAM,MAAM,GAAkC,EAAE,CAAA;IAChD,eAAe,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AAC,SAAS,CAAC,OAAO,CACjB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAC7D,CACF,CAAA;SACF;IACH,CAAC,CAAC,CAAA;IACF,OAAO,WAAW,CAAA;AACpB,CAAC;AAlBD,sEAkBC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\n\nexport function getGherkinStepMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Step> {\n const result: Record<string, messages.Step> = {}\n gherkinDocument.feature.children\n .map(extractStepContainers)\n .flat()\n .forEach((x) =>\n x.steps.forEach((step: messages.Step) => (result[step.id] = step))\n )\n return result\n}\n\nfunction extractStepContainers(\n child: messages.FeatureChild\n): Array<messages.Scenario | messages.Background> {\n if (doesHaveValue(child.background)) {\n return [child.background]\n } else if (doesHaveValue(child.rule)) {\n return child.rule.children.map((ruleChild) =>\n doesHaveValue(ruleChild.background)\n ? ruleChild.background\n : ruleChild.scenario\n )\n }\n return [child.scenario]\n}\n\nexport function getGherkinScenarioMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Scenario> {\n const result: Record<string, messages.Scenario> = {}\n gherkinDocument.feature.children\n .map((child: messages.FeatureChild) => {\n if (doesHaveValue(child.rule)) {\n return child.rule.children\n }\n return [child]\n })\n .flat()\n .forEach((x) => {\n if (x.scenario != null) {\n result[x.scenario.id] = x.scenario\n }\n })\n return result\n}\n\nexport function getGherkinExampleRuleMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Rule> {\n const result: Record<string, messages.Rule> = {}\n gherkinDocument.feature.children\n .filter((x) => x.rule != null)\n .forEach((x) =>\n x.rule.children\n .filter((child) => doesHaveValue(child.scenario))\n .forEach((child) => (result[child.scenario.id] = x.rule))\n )\n return result\n}\n\nexport function getGherkinScenarioLocationMap(\n gherkinDocument: messages.GherkinDocument\n): Record<string, messages.Location> {\n const locationMap: Record<string, messages.Location> = {}\n const scenarioMap: Record<string, messages.Scenario> =\n getGherkinScenarioMap(gherkinDocument)\n Object.keys(scenarioMap).forEach((id) => {\n const scenario = scenarioMap[id]\n locationMap[id] = scenario.location\n if (doesHaveValue(scenario.examples)) {\n scenario.examples.forEach((x) =>\n x.tableBody.forEach(\n (tableRow) => (locationMap[tableRow.id] = tableRow.location)\n )\n )\n }\n })\n return locationMap\n}\n"]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/helpers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iFAAkE;AAUzD,sDAAqB;AAT9B,8DAA+C;AASf,oCAAY;AAP5C,uEAAiE;AAAxD,gIAAA,oBAAoB,OAAA;AAC7B,+DAAsE;AAA7D,2IAAA,OAAO,OAAsB;AACtC,+CAAgE;AAAvD,2GAAA,WAAW,OAAA;AAAE,kHAAA,kBAAkB,OAAA;AACxC,iDAA4E;AAAnE,4GAAA,WAAW,OAAA;AAAE,0GAAA,SAAS,OAAA;AAAE,0GAAA,SAAS,OAAA;AAAE,wGAAA,OAAO,OAAA;AACnD,uDAAmD;AAA1C,kHAAA,cAAc,OAAA;AACvB,qDAAiD;AAAxC,gHAAA,aAAa,OAAA;AACtB,iDAA0C;AAAjC,yGAAA,QAAQ,OAAA","sourcesContent":["import * as GherkinDocumentParser from './gherkin_document_parser'\nimport * as PickleParser from './pickle_parser'\n\nexport { parseTestCaseAttempt } from './test_case_attempt_parser'\nexport { default as EventDataCollector } from './event_data_collector'\nexport { KeywordType, getStepKeywordType } from './keyword_type'\nexport { formatIssue, isWarning, isFailure, isIssue } from './issue_helpers'\nexport { formatLocation } from './location_helpers'\nexport { formatSummary } from './summary_helpers'\nexport { getUsage } from './usage_helpers'\nexport { GherkinDocumentParser, PickleParser }\n"]}
|