@cucumber/cucumber 9.5.1 → 10.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/lib/api/console_logger.d.ts +1 -1
- package/lib/api/console_logger.js +5 -2
- package/lib/api/console_logger.js.map +1 -1
- package/lib/api/convert_configuration.d.ts +2 -1
- package/lib/api/convert_configuration.js +6 -6
- package/lib/api/convert_configuration.js.map +1 -1
- package/lib/api/formatters.d.ts +2 -2
- package/lib/api/formatters.js +6 -6
- package/lib/api/formatters.js.map +1 -1
- package/lib/api/gherkin.d.ts +1 -1
- package/lib/api/gherkin.js +1 -1
- package/lib/api/gherkin.js.map +1 -1
- package/lib/api/load_configuration.js +2 -3
- package/lib/api/load_configuration.js.map +1 -1
- package/lib/api/load_sources.js +1 -1
- package/lib/api/load_sources.js.map +1 -1
- package/lib/api/load_support.d.ts +1 -1
- package/lib/api/load_support.js.map +1 -1
- package/lib/api/paths.d.ts +1 -1
- package/lib/api/paths.js +18 -16
- package/lib/api/paths.js.map +1 -1
- package/lib/api/plugins.d.ts +1 -1
- package/lib/api/plugins.js.map +1 -1
- package/lib/api/run_cucumber.js +2 -2
- package/lib/api/run_cucumber.js.map +1 -1
- package/lib/api/runtime.d.ts +3 -3
- package/lib/api/runtime.js.map +1 -1
- package/lib/api/support.js +2 -4
- package/lib/api/support.js.map +1 -1
- package/lib/api/test_helpers.js +8 -8
- package/lib/api/test_helpers.js.map +1 -1
- package/lib/api/types.d.ts +1 -1
- package/lib/api/types.js.map +1 -1
- package/lib/cli/helpers.d.ts +4 -4
- package/lib/cli/helpers.js +12 -7
- package/lib/cli/helpers.js.map +1 -1
- package/lib/cli/index.js +6 -1
- package/lib/cli/index.js.map +1 -1
- package/lib/cli/run.js +1 -1
- package/lib/cli/run.js.map +1 -1
- package/lib/cli/validate_node_engine_version.js +4 -4
- package/lib/cli/validate_node_engine_version.js.map +1 -1
- package/lib/configuration/from_file.d.ts +1 -1
- package/lib/configuration/from_file.js +41 -21
- package/lib/configuration/from_file.js.map +1 -1
- package/lib/configuration/index.d.ts +1 -1
- package/lib/configuration/index.js +1 -1
- package/lib/configuration/index.js.map +1 -1
- package/lib/configuration/locate_file.js +2 -2
- package/lib/configuration/locate_file.js.map +1 -1
- package/lib/configuration/merge_configurations.js.map +1 -1
- package/lib/configuration/split_format_descriptor.d.ts +2 -0
- package/lib/configuration/split_format_descriptor.js +76 -0
- package/lib/configuration/split_format_descriptor.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +1 -1
- package/lib/configuration/validate_configuration.js +3 -0
- package/lib/configuration/validate_configuration.js.map +1 -1
- package/lib/filter_stack_trace.js +4 -4
- package/lib/filter_stack_trace.js.map +1 -1
- package/lib/formatter/builder.d.ts +5 -5
- package/lib/formatter/builder.js +11 -24
- package/lib/formatter/builder.js.map +1 -1
- package/lib/formatter/get_color_fns.d.ts +1 -1
- package/lib/formatter/get_color_fns.js.map +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +1 -1
- package/lib/formatter/helpers/event_data_collector.js +5 -5
- package/lib/formatter/helpers/event_data_collector.js.map +1 -1
- package/lib/formatter/helpers/issue_helpers.js.map +1 -1
- package/lib/formatter/helpers/location_helpers.js +2 -2
- package/lib/formatter/helpers/location_helpers.js.map +1 -1
- package/lib/formatter/helpers/pickle_parser.js.map +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -1
- package/lib/formatter/helpers/summary_helpers.d.ts +1 -1
- package/lib/formatter/helpers/summary_helpers.js +1 -1
- package/lib/formatter/helpers/summary_helpers.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js +1 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +1 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js +3 -3
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js +1 -1
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -1
- package/lib/formatter/html_formatter.js +6 -5
- package/lib/formatter/html_formatter.js.map +1 -1
- package/lib/formatter/index.d.ts +3 -3
- package/lib/formatter/index.js +10 -0
- package/lib/formatter/index.js.map +1 -1
- package/lib/formatter/json_formatter.d.ts +1 -1
- package/lib/formatter/json_formatter.js +10 -8
- package/lib/formatter/json_formatter.js.map +1 -1
- package/lib/formatter/junit_formatter.js +11 -12
- package/lib/formatter/junit_formatter.js.map +1 -1
- package/lib/formatter/message_formatter.js +1 -1
- package/lib/formatter/message_formatter.js.map +1 -1
- package/lib/formatter/progress_bar_formatter.d.ts +1 -1
- package/lib/formatter/progress_bar_formatter.js +8 -4
- package/lib/formatter/progress_bar_formatter.js.map +1 -1
- package/lib/formatter/progress_formatter.d.ts +1 -1
- package/lib/formatter/progress_formatter.js +3 -3
- package/lib/formatter/progress_formatter.js.map +1 -1
- package/lib/formatter/rerun_formatter.js +5 -4
- package/lib/formatter/rerun_formatter.js.map +1 -1
- package/lib/formatter/snippets_formatter.js +4 -4
- package/lib/formatter/snippets_formatter.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.js +3 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -1
- package/lib/formatter/summary_formatter.d.ts +1 -1
- package/lib/formatter/summary_formatter.js +4 -4
- package/lib/formatter/summary_formatter.js.map +1 -1
- package/lib/formatter/usage_formatter.js +4 -4
- package/lib/formatter/usage_formatter.js.map +1 -1
- package/lib/formatter/usage_json_formatter.js +2 -2
- package/lib/formatter/usage_json_formatter.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +6 -6
- package/lib/index.js.map +1 -1
- package/lib/models/data_table.js +1 -0
- package/lib/models/data_table.js.map +1 -1
- package/lib/models/definition.d.ts +1 -1
- package/lib/models/definition.js +6 -0
- package/lib/models/definition.js.map +1 -1
- package/lib/models/step_definition.d.ts +1 -1
- package/lib/models/step_definition.js +5 -2
- package/lib/models/step_definition.js.map +1 -1
- package/lib/models/test_case_hook_definition.d.ts +1 -1
- package/lib/models/test_case_hook_definition.js +3 -0
- package/lib/models/test_case_hook_definition.js.map +1 -1
- package/lib/models/test_step_hook_definition.d.ts +1 -1
- package/lib/models/test_step_hook_definition.js +2 -0
- package/lib/models/test_step_hook_definition.js.map +1 -1
- package/lib/pickle_filter.js +11 -5
- package/lib/pickle_filter.js.map +1 -1
- package/lib/plugin/plugin_manager.d.ts +1 -1
- package/lib/plugin/plugin_manager.js +3 -2
- package/lib/plugin/plugin_manager.js.map +1 -1
- package/lib/plugin/types.d.ts +1 -1
- package/lib/plugin/types.js.map +1 -1
- package/lib/publish/http_stream.d.ts +2 -2
- package/lib/publish/http_stream.js +14 -9
- package/lib/publish/http_stream.js.map +1 -1
- package/lib/publish/publish_plugin.js +3 -3
- package/lib/publish/publish_plugin.js.map +1 -1
- package/lib/runtime/assemble_test_cases.d.ts +1 -1
- package/lib/runtime/assemble_test_cases.js.map +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +1 -1
- package/lib/runtime/attachment_manager/index.js +1 -0
- package/lib/runtime/attachment_manager/index.js.map +1 -1
- package/lib/runtime/format_error.js +1 -1
- package/lib/runtime/format_error.js.map +1 -1
- package/lib/runtime/helpers.d.ts +1 -1
- package/lib/runtime/helpers.js +2 -2
- package/lib/runtime/helpers.js.map +1 -1
- package/lib/runtime/index.d.ts +1 -1
- package/lib/runtime/index.js +9 -0
- package/lib/runtime/index.js.map +1 -1
- package/lib/runtime/parallel/coordinator.d.ts +4 -4
- package/lib/runtime/parallel/coordinator.js +24 -5
- package/lib/runtime/parallel/coordinator.js.map +1 -1
- package/lib/runtime/parallel/run_worker.js +1 -1
- package/lib/runtime/parallel/run_worker.js.map +1 -1
- package/lib/runtime/parallel/worker.js +14 -6
- package/lib/runtime/parallel/worker.js.map +1 -1
- package/lib/runtime/run_test_run_hooks.js +1 -1
- package/lib/runtime/run_test_run_hooks.js.map +1 -1
- package/lib/runtime/step_runner.js +2 -2
- package/lib/runtime/step_runner.js.map +1 -1
- package/lib/runtime/stopwatch.js +2 -0
- package/lib/runtime/stopwatch.js.map +1 -1
- package/lib/runtime/test_case_runner.d.ts +1 -1
- package/lib/runtime/test_case_runner.js +19 -3
- package/lib/runtime/test_case_runner.js.map +1 -1
- package/lib/step_arguments.js +2 -2
- package/lib/step_arguments.js.map +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +2 -2
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -1
- package/lib/support_code_library_builder/index.d.ts +1 -1
- package/lib/support_code_library_builder/index.js +24 -8
- package/lib/support_code_library_builder/index.js.map +1 -1
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +1 -4
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -1
- package/lib/support_code_library_builder/world.js +3 -0
- package/lib/support_code_library_builder/world.js.map +1 -1
- package/lib/time.d.ts +1 -1
- package/lib/time.js +2 -2
- package/lib/time.js.map +1 -1
- package/lib/user_code_runner.js +3 -3
- package/lib/user_code_runner.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +16 -14
- package/lib/configuration/option_splitter.d.ts +0 -3
- package/lib/configuration/option_splitter.js +0 -23
- package/lib/configuration/option_splitter.js.map +0 -1
- package/lib/formatter/fixtures/typescript.d.ts +0 -2
- package/lib/formatter/fixtures/typescript.js +0 -6
- package/lib/formatter/fixtures/typescript.js.map +0 -1
- package/lib/importer.js +0 -13
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.splitFormatDescriptor = void 0;
|
|
4
|
+
function splitFormatDescriptor(logger, option) {
|
|
5
|
+
const doWarning = (result) => {
|
|
6
|
+
let expected = `"${result[0]}"`;
|
|
7
|
+
if (result[1]) {
|
|
8
|
+
expected += `:"${result[1]}"`;
|
|
9
|
+
}
|
|
10
|
+
logger.warn(`Each part of a user-specified format should be quoted; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md#ambiguous-colons-in-formats
|
|
11
|
+
Change to ${expected}`);
|
|
12
|
+
};
|
|
13
|
+
let result;
|
|
14
|
+
let match1, match2;
|
|
15
|
+
// "foo":"bar" or "foo":bar
|
|
16
|
+
if ((match1 = option.match(/^"([^"]*)":(.*)$/)) !== null) {
|
|
17
|
+
// "foo":"bar"
|
|
18
|
+
if ((match2 = match1[2].match(/^"([^"]*)"$/)) !== null) {
|
|
19
|
+
result = [match1[1], match2[1]];
|
|
20
|
+
}
|
|
21
|
+
// "foo":bar
|
|
22
|
+
else {
|
|
23
|
+
result = [match1[1], match1[2]];
|
|
24
|
+
if (result[1].includes(':')) {
|
|
25
|
+
doWarning(result);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// foo:"bar"
|
|
30
|
+
else if ((match1 = option.match(/^(.*):"([^"]*)"$/)) !== null) {
|
|
31
|
+
result = [match1[1], match1[2]];
|
|
32
|
+
if (result[0].includes(':')) {
|
|
33
|
+
doWarning(result);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// "foo"
|
|
37
|
+
else if ((match1 = option.match(/^"([^"]*)"$/)) !== null) {
|
|
38
|
+
result = [match1[1], ''];
|
|
39
|
+
}
|
|
40
|
+
// file://foo or file:///foo or file://C:/foo or file://C:\foo or file:///C:/foo or file:///C:\foo
|
|
41
|
+
else if ((match1 = option.match(/^(file:\/{2,3}(?:[a-zA-Z]:[/\\])?)(.*)$/)) !== null) {
|
|
42
|
+
// file://foo:bar
|
|
43
|
+
if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {
|
|
44
|
+
result = [match1[1] + match2[1], match2[2]];
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
result = [option, ''];
|
|
48
|
+
}
|
|
49
|
+
doWarning(result);
|
|
50
|
+
}
|
|
51
|
+
// C:\foo or C:/foo
|
|
52
|
+
else if ((match1 = option.match(/^([a-zA-Z]:[/\\])(.*)$/)) !== null) {
|
|
53
|
+
// C:\foo:bar or C:/foo:bar
|
|
54
|
+
if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {
|
|
55
|
+
result = [match1[1] + match2[1], match2[2]];
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
result = [option, ''];
|
|
59
|
+
}
|
|
60
|
+
doWarning(result);
|
|
61
|
+
}
|
|
62
|
+
// foo:bar
|
|
63
|
+
else if ((match1 = option.match(/^([^:]*):(.*)$/)) !== null) {
|
|
64
|
+
result = [match1[1], match1[2]];
|
|
65
|
+
if (option.split(':').length > 2) {
|
|
66
|
+
doWarning(result);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// foo
|
|
70
|
+
else {
|
|
71
|
+
result = [option, ''];
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
exports.splitFormatDescriptor = splitFormatDescriptor;
|
|
76
|
+
//# sourceMappingURL=split_format_descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split_format_descriptor.js","sourceRoot":"","sources":["../../src/configuration/split_format_descriptor.ts"],"names":[],"mappings":";;;AAEA,SAAgB,qBAAqB,CACnC,MAAe,EACf,MAAc;IAEd,MAAM,SAAS,GAAG,CAAC,MAAgB,EAAE,EAAE;QACrC,IAAI,QAAQ,GAAG,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAA;QAC/B,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;YACb,QAAQ,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CA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ACH,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;KACtB;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AA7ED,sDA6EC","sourcesContent":["import { ILogger } from '../logger'\n\nexport function splitFormatDescriptor(\n logger: ILogger,\n option: string\n): string[] {\n const doWarning = (result: string[]) => {\n let expected = `\"${result[0]}\"`\n if (result[1]) {\n expected += `:\"${result[1]}\"`\n }\n logger.warn(\n `Each part of a user-specified format should be quoted; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md#ambiguous-colons-in-formats\nChange to ${expected}`\n )\n }\n let result: string[]\n let match1, match2\n\n // \"foo\":\"bar\" or \"foo\":bar\n if ((match1 = option.match(/^\"([^\"]*)\":(.*)$/)) !== null) {\n // \"foo\":\"bar\"\n if ((match2 = match1[2].match(/^\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], match2[1]]\n }\n // \"foo\":bar\n else {\n result = [match1[1], match1[2]]\n if (result[1].includes(':')) {\n doWarning(result)\n }\n }\n }\n // foo:\"bar\"\n else if ((match1 = option.match(/^(.*):\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], match1[2]]\n if (result[0].includes(':')) {\n doWarning(result)\n }\n }\n // \"foo\"\n else if ((match1 = option.match(/^\"([^\"]*)\"$/)) !== null) {\n result = [match1[1], '']\n }\n // file://foo or file:///foo or file://C:/foo or file://C:\\foo or file:///C:/foo or file:///C:\\foo\n else if (\n (match1 = option.match(/^(file:\\/{2,3}(?:[a-zA-Z]:[/\\\\])?)(.*)$/)) !== null\n ) {\n // file://foo:bar\n if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1] + match2[1], match2[2]]\n } else {\n result = [option, '']\n }\n doWarning(result)\n }\n // C:\\foo or C:/foo\n else if ((match1 = option.match(/^([a-zA-Z]:[/\\\\])(.*)$/)) !== null) {\n // C:\\foo:bar or C:/foo:bar\n if ((match2 = match1[2].match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1] + match2[1], match2[2]]\n } else {\n result = [option, '']\n }\n doWarning(result)\n }\n // foo:bar\n else if ((match1 = option.match(/^([^:]*):(.*)$/)) !== null) {\n result = [match1[1], match1[2]]\n if (option.split(':').length > 2) {\n doWarning(result)\n }\n }\n // foo\n else {\n result = [option, '']\n }\n\n return result\n}\n"]}
|
|
@@ -5,6 +5,9 @@ function validateConfiguration(configuration, logger) {
|
|
|
5
5
|
if (configuration.publishQuiet) {
|
|
6
6
|
logger.warn('`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md');
|
|
7
7
|
}
|
|
8
|
+
if (configuration.requireModule.length && !configuration.require.length) {
|
|
9
|
+
logger.warn('Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code');
|
|
10
|
+
}
|
|
8
11
|
if (configuration.retryTagFilter && !configuration.retry) {
|
|
9
12
|
throw new Error('a positive `retry` count must be specified when setting `retryTagFilter`');
|
|
10
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"validate_configuration.js","sourceRoot":"","sources":["../../src/configuration/validate_configuration.ts"],"names":[],"mappings":";;;AAGA,SAAgB,qBAAqB,CACnC,aAA6B,EAC7B,MAAe;IAEf,IAAI,aAAa,CAAC,YAAY,EAAE;QAC9B,MAAM,CAAC,IAAI,CACT,kKAAkK,CACnK,CAAA;KACF;IACD,IAAI,aAAa,CAAC,aAAa,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE;QACvE,MAAM,CAAC,IAAI,CACT,wMAAwM,CACzM,CAAA;KACF;IACD,IAAI,aAAa,CAAC,cAAc,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE;QACxD,MAAM,IAAI,KAAK,CACb,0EAA0E,CAC3E,CAAA;KACF;AACH,CAAC;AAnBD,sDAmBC","sourcesContent":["import { ILogger } from '../logger'\nimport { IConfiguration } from './types'\n\nexport function validateConfiguration(\n configuration: IConfiguration,\n logger: ILogger\n): void {\n if (configuration.publishQuiet) {\n logger.warn(\n '`publishQuiet` option is no longer needed, you can remove it from your configuration; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n )\n }\n if (configuration.requireModule.length && !configuration.require.length) {\n logger.warn(\n 'Use of `require-module` option normally means you should specify your support code paths with `require`; see https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#finding-your-code'\n )\n }\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"]}
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.filterStackTrace = exports.isFileNameInCucumber = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const value_checker_1 = require("./value_checker");
|
|
9
|
-
const projectRootPath =
|
|
9
|
+
const projectRootPath = node_path_1.default.join(__dirname, '..');
|
|
10
10
|
const projectChildDirs = ['src', 'lib', 'node_modules'];
|
|
11
11
|
function isFileNameInCucumber(fileName) {
|
|
12
|
-
return projectChildDirs.some((dir) => fileName.startsWith(
|
|
12
|
+
return projectChildDirs.some((dir) => fileName.startsWith(node_path_1.default.join(projectRootPath, dir)));
|
|
13
13
|
}
|
|
14
14
|
exports.isFileNameInCucumber = isFileNameInCucumber;
|
|
15
15
|
function filterStackTrace(frames) {
|
|
@@ -33,6 +33,6 @@ function isFrameInCucumber(frame) {
|
|
|
33
33
|
}
|
|
34
34
|
function isFrameInNode(frame) {
|
|
35
35
|
const fileName = (0, value_checker_1.valueOrDefault)(frame.getFileName(), '');
|
|
36
|
-
return !fileName.includes(
|
|
36
|
+
return !fileName.includes(node_path_1.default.sep);
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=filter_stack_trace.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"filter_stack_trace.js","sourceRoot":"","sources":["../src/filter_stack_trace.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAE5B,mDAAgD;AAEhD,MAAM,eAAe,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAA;AAClD,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,CAAC,CAAA;AAEvD,SAAgB,oBAAoB,CAAC,QAAgB;IACnD,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,QAAQ,CAAC,UAAU,CAAC,mBAAI,CAAC,IAAI,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC,CACrD,CAAA;AACH,CAAC;AAJD,oDAIC;AAED,SAAgB,gBAAgB,CAAC,MAAoB;IACnD,IAAI,iBAAiB,CAAC,MAAM,CAAC,EAAE;QAC7B,OAAO,MAAM,CAAA;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3D,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;QAChB,OAAO,MAAM,CAAA;KACd;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAC/B,CAAC;AATD,4CASC;AAED,SAAS,iBAAiB,CAAC,MAAoB;IAC7C,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9D,OAAO,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAC1E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAiB;IAC1C,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,oBAAoB,CAAC,QAAQ,CAAC,CAAA;AACvC,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,MAAM,QAAQ,GAAG,IAAA,8BAAc,EAAC,KAAK,CAAC,WAAW,EAAE,EAAE,EAAE,CAAC,CAAA;IACxD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,mBAAI,CAAC,GAAG,CAAC,CAAA;AACrC,CAAC","sourcesContent":["import path from 'node:path'\nimport { StackFrame } from 'error-stack-parser'\nimport { valueOrDefault } from './value_checker'\n\nconst projectRootPath = path.join(__dirname, '..')\nconst projectChildDirs = ['src', 'lib', 'node_modules']\n\nexport function isFileNameInCucumber(fileName: string): boolean {\n return projectChildDirs.some((dir) =>\n fileName.startsWith(path.join(projectRootPath, dir))\n )\n}\n\nexport function filterStackTrace(frames: StackFrame[]): StackFrame[] {\n if (isErrorInCucumber(frames)) {\n return frames\n }\n const index = frames.findIndex((x) => isFrameInCucumber(x))\n if (index === -1) {\n return frames\n }\n return frames.slice(0, index)\n}\n\nfunction isErrorInCucumber(frames: StackFrame[]): boolean {\n const filteredFrames = frames.filter((x) => !isFrameInNode(x))\n return filteredFrames.length > 0 && isFrameInCucumber(filteredFrames[0])\n}\n\nfunction isFrameInCucumber(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return isFileNameInCucumber(fileName)\n}\n\nfunction isFrameInNode(frame: StackFrame): boolean {\n const fileName = valueOrDefault(frame.getFileName(), '')\n return !fileName.includes(path.sep)\n}\n"]}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
/// <reference types="node" />
|
|
4
4
|
/// <reference types="node" />
|
|
5
|
-
import
|
|
5
|
+
import { EventEmitter } from 'node:events';
|
|
6
|
+
import { Writable as WritableStream } from 'node:stream';
|
|
6
7
|
import { ISupportCodeLibrary } from '../support_code_library_builder/types';
|
|
7
|
-
import Formatter, { FormatOptions, IFormatterCleanupFn, IFormatterLogFn } from '.';
|
|
8
|
-
import { EventEmitter } from 'events';
|
|
9
|
-
import EventDataCollector from './helpers/event_data_collector';
|
|
10
|
-
import { Writable as WritableStream } from 'stream';
|
|
11
8
|
import { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax';
|
|
9
|
+
import EventDataCollector from './helpers/event_data_collector';
|
|
10
|
+
import StepDefinitionSnippetBuilder from './step_definition_snippet_builder';
|
|
11
|
+
import Formatter, { FormatOptions, IFormatterCleanupFn, IFormatterLogFn } from '.';
|
|
12
12
|
interface IGetStepDefinitionSnippetBuilderOptions {
|
|
13
13
|
cwd: string;
|
|
14
14
|
snippetInterface?: SnippetInterface;
|
package/lib/formatter/builder.js
CHANGED
|
@@ -3,16 +3,14 @@ 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
|
-
const
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const step_definition_snippet_builder_1 = __importDefault(require("./step_definition_snippet_builder"));
|
|
6
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
7
|
+
const node_url_1 = require("node:url");
|
|
10
8
|
const value_checker_1 = require("../value_checker");
|
|
11
9
|
const snippet_syntax_1 = require("./step_definition_snippet_builder/snippet_syntax");
|
|
12
|
-
const
|
|
10
|
+
const step_definition_snippet_builder_1 = __importDefault(require("./step_definition_snippet_builder"));
|
|
11
|
+
const javascript_snippet_syntax_1 = __importDefault(require("./step_definition_snippet_builder/javascript_snippet_syntax"));
|
|
12
|
+
const get_color_fns_1 = __importDefault(require("./get_color_fns"));
|
|
13
13
|
const formatters_1 = __importDefault(require("./helpers/formatters"));
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
|
-
const { importer } = require('../importer');
|
|
16
14
|
const FormatterBuilder = {
|
|
17
15
|
async build(type, options) {
|
|
18
16
|
const FormatterConstructor = await FormatterBuilder.getConstructorByType(type, options.cwd);
|
|
@@ -51,7 +49,7 @@ const FormatterBuilder = {
|
|
|
51
49
|
async loadCustomClass(type, descriptor, cwd) {
|
|
52
50
|
let normalized = descriptor;
|
|
53
51
|
if (descriptor.startsWith('.')) {
|
|
54
|
-
normalized = (0,
|
|
52
|
+
normalized = (0, node_url_1.pathToFileURL)(node_path_1.default.resolve(cwd, descriptor));
|
|
55
53
|
}
|
|
56
54
|
else if (descriptor.startsWith('file://')) {
|
|
57
55
|
normalized = new URL(descriptor);
|
|
@@ -66,22 +64,7 @@ const FormatterBuilder = {
|
|
|
66
64
|
}
|
|
67
65
|
},
|
|
68
66
|
async loadFile(urlOrName) {
|
|
69
|
-
|
|
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;
|
|
67
|
+
return await import(urlOrName.toString());
|
|
85
68
|
},
|
|
86
69
|
resolveConstructor(ImportedCode) {
|
|
87
70
|
if ((0, value_checker_1.doesNotHaveValue)(ImportedCode)) {
|
|
@@ -94,6 +77,10 @@ const FormatterBuilder = {
|
|
|
94
77
|
typeof ImportedCode.default === 'function') {
|
|
95
78
|
return ImportedCode.default;
|
|
96
79
|
}
|
|
80
|
+
else if (typeof ImportedCode.default === 'object' &&
|
|
81
|
+
typeof ImportedCode.default.default === 'function') {
|
|
82
|
+
return ImportedCode.default.default;
|
|
83
|
+
}
|
|
97
84
|
return null;
|
|
98
85
|
},
|
|
99
86
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/formatter/builder.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAG5B,uCAAwC;AACxC,oDAAkE;AAElE,qFAAmF;AAEnF,wGAA4E;AAC5E,4HAAiG;AACjG,oEAAyC;AACzC,sEAA6C;AA0B7C,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,EAC1B,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,GAAG,EACX,OAAO,CAAC,iBAAiB,CAAC,aAAa,CACxC,CAAA;QACD,MAAM,cAAc,GAClB,MAAM,gBAAgB,CAAC,+BAA+B,CAAC;YACrD,GAAG,EA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ourcesContent":["import path from 'node:path'\nimport { EventEmitter } from 'node:events'\nimport { Writable as WritableStream } from 'node:stream'\nimport { pathToFileURL } from 'node:url'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { ISupportCodeLibrary } from '../support_code_library_builder/types'\nimport { SnippetInterface } from './step_definition_snippet_builder/snippet_syntax'\nimport EventDataCollector from './helpers/event_data_collector'\nimport StepDefinitionSnippetBuilder from './step_definition_snippet_builder'\nimport JavascriptSnippetSyntax from './step_definition_snippet_builder/javascript_snippet_syntax'\nimport getColorFns from './get_color_fns'\nimport Formatters from './helpers/formatters'\nimport Formatter, {\n FormatOptions,\n IFormatterCleanupFn,\n IFormatterLogFn,\n} from '.'\n\ninterface IGetStepDefinitionSnippetBuilderOptions {\n cwd: string\n snippetInterface?: SnippetInterface\n snippetSyntax?: string\n supportCodeLibrary: ISupportCodeLibrary\n}\n\nexport interface IBuildOptions {\n env: NodeJS.ProcessEnv\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(\n options.stream,\n options.env,\n options.parsedArgvOptions.colorsEnabled\n )\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 normalized: URL | string = descriptor\n if (descriptor.startsWith('.')) {\n normalized = pathToFileURL(path.resolve(cwd, descriptor))\n } else if (descriptor.startsWith('file://')) {\n normalized = new URL(descriptor)\n }\n let CustomClass = await FormatterBuilder.loadFile(normalized)\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 return await import(urlOrName.toString())\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 } else if (\n typeof ImportedCode.default === 'object' &&\n typeof ImportedCode.default.default === 'function'\n ) {\n return ImportedCode.default.default\n }\n return null\n },\n}\n\nexport default FormatterBuilder\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { Writable } from 'node:stream';
|
|
3
4
|
import { TestStepResultStatus } from '@cucumber/messages';
|
|
4
|
-
import { Writable } from 'stream';
|
|
5
5
|
export type IColorFn = (text: string) => string;
|
|
6
6
|
export interface IColorFns {
|
|
7
7
|
forStatus: (status: TestStepResultStatus) => IColorFn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"get_color_fns.js","sourceRoot":"","sources":["../../src/formatter/get_color_fns.ts"],"names":[],"mappings":";;;;;AACA,kDAAyB;AACzB,mDAAyD;AAEzD,oDAAmD;AAcnD,SAAwB,WAAW,CACjC,MAAgB,EAChB,GAAsB,EACtB,OAAiB;IAEjB,MAAM,OAAO,GAAc,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,CAAC,CAAA;IAC9D,IAAI,OAAO,EAAE;QACX,MAAM,aAAa,GAAG,IAAI,eAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QACjD,OAAO;YACL,SAAS,CAAC,MAA4B;gBACpC,OAAO;oBACL,SAAS,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBACxC,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,eAAK,CAAC;oBACrC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,eAAK,CAAC;oBACvC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBACzC,OAAO,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,eAAK,CAAC;oBACvC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;oBAC3C,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,eAAK,CAAC;iBAC1C,CAAC,MAAM,CAAC,CAAA;YACX,CAAC;YACD,QAAQ,EAAE,aAAa,CAAC,IAA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able } from 'node:stream'\nimport chalk from 'chalk'\nimport { ColorInfo, supportsColor } from 'supports-color'\nimport { TestStepResultStatus } from '@cucumber/messages'\nimport { doesNotHaveValue } from '../value_checker'\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(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): IColorFns {\n const support: ColorInfo = detectSupport(stream, env, enabled)\n if (support) {\n const chalkInstance = new chalk.Instance(support)\n return {\n forStatus(status: TestStepResultStatus) {\n return {\n AMBIGUOUS: chalkInstance.red.bind(chalk),\n FAILED: chalkInstance.red.bind(chalk),\n PASSED: chalkInstance.green.bind(chalk),\n PENDING: chalkInstance.yellow.bind(chalk),\n SKIPPED: chalkInstance.cyan.bind(chalk),\n UNDEFINED: chalkInstance.yellow.bind(chalk),\n UNKNOWN: chalkInstance.yellow.bind(chalk),\n }[status]\n },\n location: chalkInstance.gray.bind(chalk),\n tag: chalkInstance.cyan.bind(chalk),\n diffAdded: chalkInstance.green.bind(chalk),\n diffRemoved: chalkInstance.red.bind(chalk),\n errorMessage: chalkInstance.red.bind(chalk),\n errorStack: chalkInstance.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\nfunction detectSupport(\n stream: Writable,\n env: NodeJS.ProcessEnv,\n enabled?: boolean\n): ColorInfo {\n const support: ColorInfo = supportsColor(stream)\n // if we find FORCE_COLOR, we can let the supports-color library handle that\n if ('FORCE_COLOR' in env || doesNotHaveValue(enabled)) {\n return support\n }\n return enabled ? support || { level: 1 } : false\n}\n"]}
|
|
@@ -26,12 +26,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
const messages = __importStar(require("@cucumber/messages"));
|
|
27
27
|
const value_checker_1 = require("../../value_checker");
|
|
28
28
|
class EventDataCollector {
|
|
29
|
+
gherkinDocumentMap = {};
|
|
30
|
+
pickleMap = {};
|
|
31
|
+
testCaseMap = {};
|
|
32
|
+
testCaseAttemptDataMap = {};
|
|
33
|
+
undefinedParameterTypes = [];
|
|
29
34
|
constructor(eventBroadcaster) {
|
|
30
|
-
this.gherkinDocumentMap = {};
|
|
31
|
-
this.pickleMap = {};
|
|
32
|
-
this.testCaseMap = {};
|
|
33
|
-
this.testCaseAttemptDataMap = {};
|
|
34
|
-
this.undefinedParameterTypes = [];
|
|
35
35
|
eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
|
|
36
36
|
}
|
|
37
37
|
getGherkinDocument(uri) {
|
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,uDAAqE;AAsBrE,MAAqB,kBAAkB;IAC7B,kBAAkB,GAA6C,EAAE,CAAA;IACjE,SAAS,GAAoC,EAAE,CAAA;IAC/C,WAAW,GAAsC,EAAE,CAAA;IACnD,sBAAsB,GAAyC,EAAE,CAAA;IAChE,uBAAuB,GAAsC,EAAE,CAAA;IAExE,YAAY,gBAA8B;QACxC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAChE,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,OAAO,IAAI,CAAC,kBAAkB,C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AC,EAAE,KAAK,EAAE,CAAC,EAAE;gBAClC,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO;aAC9C;SACF,CAAA;IACH,CAAC;IAED,eAAe,CAAC,UAA+B;QAC7C,MAAM,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,UAAU,CAAA;QACpD,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 { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\ninterface ITestCaseAttemptData {\n attempt: number\n willBeRetried: boolean\n testCaseId: string\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n worstTestStepResult: messages.TestStepResult\n}\n\nexport interface ITestCaseAttempt {\n attempt: number\n willBeRetried: boolean\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n stepAttachments: Record<string, messages.Attachment[]>\n stepResults: Record<string, messages.TestStepResult>\n testCase: messages.TestCase\n worstTestStepResult: messages.TestStepResult\n}\n\nexport default class EventDataCollector {\n private gherkinDocumentMap: Record<string, messages.GherkinDocument> = {}\n private pickleMap: Record<string, messages.Pickle> = {}\n private testCaseMap: Record<string, messages.TestCase> = {}\n private testCaseAttemptDataMap: Record<string, ITestCaseAttemptData> = {}\n readonly undefinedParameterTypes: messages.UndefinedParameterType[] = []\n\n constructor(eventBroadcaster: EventEmitter) {\n eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n }\n\n getGherkinDocument(uri: string): messages.GherkinDocument {\n return this.gherkinDocumentMap[uri]\n }\n\n getPickle(pickleId: string): messages.Pickle {\n return this.pickleMap[pickleId]\n }\n\n getTestCaseAttempts(): ITestCaseAttempt[] {\n return Object.keys(this.testCaseAttemptDataMap).map((testCaseStartedId) => {\n return this.getTestCaseAttempt(testCaseStartedId)\n })\n }\n\n getTestCaseAttempt(testCaseStartedId: string): ITestCaseAttempt {\n const testCaseAttemptData = this.testCaseAttemptDataMap[testCaseStartedId]\n const testCase = this.testCaseMap[testCaseAttemptData.testCaseId]\n const pickle = this.pickleMap[testCase.pickleId]\n return {\n gherkinDocument: this.gherkinDocumentMap[pickle.uri],\n pickle,\n testCase,\n attempt: testCaseAttemptData.attempt,\n willBeRetried: testCaseAttemptData.willBeRetried,\n stepAttachments: testCaseAttemptData.stepAttachments,\n stepResults: testCaseAttemptData.stepResults,\n worstTestStepResult: testCaseAttemptData.worstTestStepResult,\n }\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.gherkinDocument)) {\n this.gherkinDocumentMap[envelope.gherkinDocument.uri] =\n envelope.gherkinDocument\n } else if (doesHaveValue(envelope.pickle)) {\n this.pickleMap[envelope.pickle.id] = envelope.pickle\n } else if (doesHaveValue(envelope.undefinedParameterType)) {\n this.undefinedParameterTypes.push(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.testCaseMap[envelope.testCase.id] = envelope.testCase\n } else if (doesHaveValue(envelope.testCaseStarted)) {\n this.initTestCaseAttempt(envelope.testCaseStarted)\n } else if (doesHaveValue(envelope.attachment)) {\n this.storeAttachment(envelope.attachment)\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.storeTestStepResult(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.storeTestCaseResult(envelope.testCaseFinished)\n }\n }\n\n private initTestCaseAttempt(testCaseStarted: messages.TestCaseStarted): void {\n this.testCaseAttemptDataMap[testCaseStarted.id] = {\n attempt: testCaseStarted.attempt,\n willBeRetried: false,\n testCaseId: testCaseStarted.testCaseId,\n stepAttachments: {},\n stepResults: {},\n worstTestStepResult: {\n duration: { seconds: 0, nanos: 0 },\n status: messages.TestStepResultStatus.UNKNOWN,\n },\n }\n }\n\n storeAttachment(attachment: messages.Attachment): void {\n const { testCaseStartedId, testStepId } = attachment\n // 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"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;
|
|
1
|
+
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AAKxC,+EAAqE;AAGrE,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,MAAM,CAAC,MAAM,KAAK,WAAW;QAC7B,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,CAAC,aAAa,CAAC,CAC/C,CAAA;AACH,CAAC;AATD,8BASC;AAED,SAAgB,SAAS,CACvB,MAA+B,EAC/B,gBAAyB,KAAK;IAE9B,OAAO,CACL,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,aAAa,CAAC,CAC7E,CAAA;AACH,CAAC;AAPD,8BAOC;AAED,SAAgB,OAAO,CAAC,MAA+B;IACrD,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAA;AAC/C,CAAC;AAFD,0BAEC;AAWD,SAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,MAAM,EACN,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GAAG,IAAI,GACH;IACpB,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAA;IACvC,MAA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AAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { IColorFns } from '../get_color_fns'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nexport function isFailure(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'AMBIGUOUS' ||\n result.status === 'UNDEFINED' ||\n (result.status === 'FAILED' && !willBeRetried)\n )\n}\n\nexport function isWarning(\n result: messages.TestStepResult,\n willBeRetried: boolean = false\n): boolean {\n return (\n result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried)\n )\n}\n\nexport function isIssue(result: messages.TestStepResult): boolean {\n return isFailure(result) || isWarning(result)\n}\n\nexport interface IFormatIssueRequest {\n colorFns: IColorFns\n number: number\n snippetBuilder: StepDefinitionSnippetBuilder\n testCaseAttempt: ITestCaseAttempt\n supportCodeLibrary: ISupportCodeLibrary\n printAttachments?: boolean\n}\n\nexport function formatIssue({\n colorFns,\n number,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments = true,\n}: IFormatIssueRequest): string {\n const prefix = `${number.toString()}) `\n const formattedTestCaseAttempt = formatTestCaseAttempt({\n colorFns,\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n printAttachments,\n })\n const lines = formattedTestCaseAttempt.split('\\n')\n const updatedLines = lines.map((line, index) => {\n if (index === 0) {\n return `${prefix}${line}`\n }\n return indentString(line, prefix.length)\n })\n return updatedLines.join('\\n')\n}\n\nexport function formatUndefinedParameterTypes(\n undefinedParameterTypes: messages.UndefinedParameterType[]\n): string {\n const output = [`Undefined parameter types:\\n\\n`]\n const withLatest: Record<string, messages.UndefinedParameterType> = {}\n undefinedParameterTypes.forEach((parameterType) => {\n withLatest[parameterType.name] = parameterType\n })\n output.push(\n Object.values(withLatest)\n .map(\n (parameterType) => `- ${formatUndefinedParameterType(parameterType)}`\n )\n .join('\\n')\n )\n output.push('\\n\\n')\n return output.join('')\n}\n\nexport function formatUndefinedParameterType(\n parameterType: messages.UndefinedParameterType\n): string {\n return `\"${parameterType.name}\" e.g. \\`${parameterType.expression}\\``\n}\n"]}
|
|
@@ -4,12 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.formatLocation = void 0;
|
|
7
|
-
const
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
8
|
const value_checker_1 = require("../../value_checker");
|
|
9
9
|
function formatLocation(obj, cwd) {
|
|
10
10
|
let uri = obj.uri;
|
|
11
11
|
if ((0, value_checker_1.doesHaveValue)(cwd)) {
|
|
12
|
-
uri =
|
|
12
|
+
uri = node_path_1.default.relative(cwd, uri);
|
|
13
13
|
}
|
|
14
14
|
return `${uri}:${obj.line.toString()}`;
|
|
15
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,uDAAmD;AAGnD,SAAgB,cAAc,CAAC,GAAgB,EAAE,GAAY;IAC3D,IAAI,GAAG,GAAG,GAAG,CAAC,GAAG,CAAA;IACjB,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE;QACtB,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;KAC9B;IACD,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAA;AACxC,CAAC;AAND,wCAMC","sourcesContent":["import path from 'node:path'\nimport { doesHaveValue } from '../../value_checker'\nimport { ILineAndUri } from '../../types'\n\nexport function formatLocation(obj: ILineAndUri, cwd?: string): string {\n let uri = obj.uri\n if (doesHaveValue(cwd)) {\n uri = path.relative(cwd, uri)\n }\n return `${uri}:${obj.line.toString()}`\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;AACA,uEAAyE;AAiBzE,SAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,kBAAkB,GACa;IAC/B,OAAO,MAAM,CAAC,UAAU;SACrB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC;SACnC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC5C,CAAC;AAPD,wDAOC;AAED,SAAgB,cAAc,CAAC,EAC7B,UAAU,EACV,cAAc,GACS;IACvB,OAAO,UAAU,CAAC,UAAU;SACzB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;SAC/B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA;AACxC,CAAC;AAPD,wCAOC;AAED,SAAgB,gBAAgB,CAC9B,MAAuB;IAEvB,MAAM,MAAM,GAAwC,EAAE,CAAA;IACtD,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAA;IAC1E,OAAO,MAAM,CAAA;AACf,CAAC;AAND,4CAMC;AAED,SAAgB,iBAAiB,CAAC,EAChC,eAAe,EACf,MAAM,GACoB;IAC1B,MAAM,0BAA0B,GAC9B,IAAA,uDAA6B,EAAC,eAAe,CAAC,CAAA;IAChD,OAAO,0BAA0B,CAC/B,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,CAChD,CAAA;AACH,CAAC;AATD,8CASC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { getGherkinScenarioLocationMap } from './gherkin_document_parser'\n\nexport interface IGetPickleLocationRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport interface IGetStepKeywordRequest {\n pickleStep: messages.PickleStep\n gherkinStepMap: Record<string, messages.Step>\n}\n\nexport interface IGetScenarioDescriptionRequest {\n pickle: messages.Pickle\n gherkinScenarioMap: Record<string, messages.Scenario>\n}\n\nexport function getScenarioDescription({\n pickle,\n gherkinScenarioMap,\n}: IGetScenarioDescriptionRequest): string {\n return pickle.astNodeIds\n .map((id) => gherkinScenarioMap[id])\n .filter((x) => x != null)[0].description\n}\n\nexport function getStepKeyword({\n pickleStep,\n gherkinStepMap,\n}: IGetStepKeywordRequest): string {\n return pickleStep.astNodeIds\n .map((id) => gherkinStepMap[id])\n .filter((x) => x != null)[0].keyword\n}\n\nexport function getPickleStepMap(\n pickle: messages.Pickle\n): Record<string, messages.PickleStep> {\n const result: Record<string, messages.PickleStep> = {}\n pickle.steps.forEach((pickleStep) => (result[pickleStep.id] = pickleStep))\n return result\n}\n\nexport function getPickleLocation({\n gherkinDocument,\n pickle,\n}: IGetPickleLocationRequest): messages.Location {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n return gherkinScenarioLocationMap[\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n ]\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;
|
|
1
|
+
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAE9B,yDAAwD;AAExD,SAAS,eAAe,CAAC,SAA+B;IACtD,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,GAAG;YACT,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;YACV,WAAW,EAAE,EAAE;YACf,GAAG,EAAE,EAAE;YACP,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,EAAE;SAChB;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,cAAc,EAAE,CAAC;YACjB,eAAe,EAAE,CAAC;SACnB;KACF,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CACtC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACrB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CACxD,CACF,CAAA;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAA;IACnB,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAA;AACzB,CAAC;AAED,SAAS,eAAe,CAAC,SAAmC;IAC1D,OAAO,QAAQ,SAAS,CAAC,OAAO,OAAO,CAAA;AACzC,CAAC;AAED,SAAgB,kBAAkB,CAAC,GAAgC;IACjE,OAAO,IAAA,kCAAiB,EAAC,GAAG,EAAE;QAC5B,SAAS,EAAE,eAAe;QAC1B,SAAS,EAAE,eAAe;KAC3B,CAAC,CAAA;AACJ,CAAC;AALD,gDAKC","sourcesContent":["import Table from 'cli-table3'\nimport * as messages from '@cucumber/messages'\nimport { parseStepArgument } from '../../step_arguments'\n\nfunction formatDataTable(dataTable: messages.PickleTable): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '|',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: '|',\n right: '|',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 1,\n 'padding-right': 1,\n },\n })\n const rows = dataTable.rows.map((row) =>\n row.cells.map((cell) =>\n cell.value.replace(/\\\\/g, '\\\\\\\\').replace(/\\n/g, '\\\\n')\n )\n )\n table.push(...rows)\n return table.toString()\n}\n\nfunction formatDocString(docString: messages.PickleDocString): string {\n return `\"\"\"\\n${docString.content}\\n\"\"\"`\n}\n\nexport function formatStepArgument(arg: messages.PickleStepArgument): string {\n return parseStepArgument(arg, {\n dataTable: formatDataTable,\n docString: formatDocString,\n })\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
1
2
|
import { IColorFns } from '../get_color_fns';
|
|
2
3
|
import { ITestCaseAttempt } from './event_data_collector';
|
|
3
|
-
import * as messages from '@cucumber/messages';
|
|
4
4
|
export interface IFormatSummaryRequest {
|
|
5
5
|
colorFns: IColorFns;
|
|
6
6
|
testCaseAttempts: ITestCaseAttempt[];
|
|
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.formatSummary = void 0;
|
|
27
27
|
const messages = __importStar(require("@cucumber/messages"));
|
|
28
|
-
const value_checker_1 = require("../../value_checker");
|
|
29
28
|
const luxon_1 = require("luxon");
|
|
29
|
+
const value_checker_1 = require("../../value_checker");
|
|
30
30
|
const STATUS_REPORT_ORDER = [
|
|
31
31
|
messages.TestStepResultStatus.FAILED,
|
|
32
32
|
messages.TestStepResultStatus.AMBIGUOUS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA8C;AAC9C,iCAAgC;AAEhC,uDAAmD;AAGnD,MAAM,mBAAmB,GAAG;IAC1B,QAAQ,CAAC,oBAAoB,CAAC,MAAM;IACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;IACvC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,OAAO;IACrC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;CACrC,CAAA;AAQD,SAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,gBAAgB,EAChB,eAAe,GACO;IACtB,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,MAAM,eAAe,GAA8B,EAAE,CAAA;IACrD,IAAI,iBAAiB,GAAG,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAA;IACzE,gBAAgB,CAAC,OAAO,CACtB,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,EAAE,EAAE;QAChE,MAAM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7D,SAAS;QACT,SAAS;QACT,cAAc;KACf,CAAC,CAAA;IACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { Interval } from 'luxon'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue } from '../../value_checker'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nconst STATUS_REPORT_ORDER = [\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.UNDEFINED,\n messages.TestStepResultStatus.PENDING,\n messages.TestStepResultStatus.SKIPPED,\n messages.TestStepResultStatus.PASSED,\n]\n\nexport interface IFormatSummaryRequest {\n colorFns: IColorFns\n testCaseAttempts: ITestCaseAttempt[]\n testRunDuration: messages.Duration\n}\n\nexport function formatSummary({\n colorFns,\n testCaseAttempts,\n testRunDuration,\n}: IFormatSummaryRequest): string {\n const testCaseResults: messages.TestStepResult[] = []\n const testStepResults: messages.TestStepResult[] = []\n let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0)\n testCaseAttempts.forEach(\n ({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {\n Object.values(stepResults).forEach((stepResult) => {\n totalStepDuration = messages.TimeConversion.addDurations(\n totalStepDuration,\n stepResult.duration\n )\n })\n if (!willBeRetried) {\n testCaseResults.push(worstTestStepResult)\n testCase.testSteps.forEach((testStep) => {\n if (doesHaveValue(testStep.pickleStepId)) {\n testStepResults.push(stepResults[testStep.id])\n }\n })\n }\n }\n )\n const scenarioSummary = getCountSummary({\n colorFns,\n objects: testCaseResults,\n type: 'scenario',\n })\n const stepSummary = getCountSummary({\n colorFns,\n objects: testStepResults,\n type: 'step',\n })\n const durationSummary = `${getDurationSummary(\n testRunDuration\n )} (executing steps: ${getDurationSummary(totalStepDuration)})\\n`\n return [scenarioSummary, stepSummary, durationSummary].join('\\n')\n}\n\ninterface IGetCountSummaryRequest {\n colorFns: IColorFns\n objects: messages.TestStepResult[]\n type: string\n}\n\nfunction getCountSummary({\n colorFns,\n objects,\n type,\n}: IGetCountSummaryRequest): string {\n const counts: Record<string, number> = {}\n STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0))\n objects.forEach((x) => (counts[x.status] += 1))\n const total = Object.values(counts).reduce((acc, x) => acc + x, 0)\n let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`\n if (total > 0) {\n const details: string[] = []\n STATUS_REPORT_ORDER.forEach((status) => {\n if (counts[status] > 0) {\n details.push(\n colorFns.forStatus(status)(\n `${counts[status].toString()} ${status.toLowerCase()}`\n )\n )\n }\n })\n text += ` (${details.join(', ')})`\n }\n return text\n}\n\nfunction getDurationSummary(durationMsg: messages.Duration): string {\n const start = new Date(0)\n const end = new Date(\n messages.TimeConversion.durationToMilliseconds(durationMsg)\n )\n const duration = Interval.fromDateTimes(start, end).toDuration([\n 'minutes',\n 'seconds',\n 'milliseconds',\n ])\n return duration.toFormat(\"m'm'ss.SSS's'\")\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IColorFns } from '../get_color_fns';
|
|
2
|
-
import { ITestCaseAttempt } from './event_data_collector';
|
|
3
2
|
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
|
|
4
3
|
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
|
|
4
|
+
import { ITestCaseAttempt } from './event_data_collector';
|
|
5
5
|
export interface IFormatTestCaseAttemptRequest {
|
|
6
6
|
colorFns: IColorFns;
|
|
7
7
|
testCaseAttempt: ITestCaseAttempt;
|
|
@@ -30,10 +30,10 @@ exports.formatTestCaseAttempt = void 0;
|
|
|
30
30
|
const indent_string_1 = __importDefault(require("indent-string"));
|
|
31
31
|
const messages = __importStar(require("@cucumber/messages"));
|
|
32
32
|
const figures_1 = __importDefault(require("figures"));
|
|
33
|
+
const value_checker_1 = require("../../value_checker");
|
|
33
34
|
const location_helpers_1 = require("./location_helpers");
|
|
34
35
|
const test_case_attempt_parser_1 = require("./test_case_attempt_parser");
|
|
35
36
|
const step_argument_formatter_1 = require("./step_argument_formatter");
|
|
36
|
-
const value_checker_1 = require("../../value_checker");
|
|
37
37
|
const CHARACTERS = new Map([
|
|
38
38
|
[messages.TestStepResultStatus.AMBIGUOUS, figures_1.default.cross],
|
|
39
39
|
[messages.TestStepResultStatus.FAILED, figures_1.default.cross],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,6DAA8C;AAC9C,sDAA6B;
|
|
1
|
+
{"version":3,"file":"test_case_attempt_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/test_case_attempt_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAAwC;AACxC,6DAA8C;AAC9C,sDAA6B;AAE7B,uDAAmE;AAGnE,yDAAmD;AACnD,yEAGmC;AACnC,uEAA8D;AAG9D,MAAM,UAAU,GAA+C,IAAI,GAAG,CAAC;IACrE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,iBAAO,CAAC,KAAK,CAAC;IACxD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,KAAK,CAAC;IACrD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,iBAAO,CAAC,IAAI,CAAC;IACpD,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;CAC/C,CAAC,CAAA;AAEF,SAAS,cAAc,CAAC,QAAyB;IAC/C,QAAQ,QAAQ,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M,CAAC,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC,aAAa,CAAC,CAAA;IAC9E,IAAI,IAAI,MAAM,QAAQ,CAAC,QAAQ,CAC7B,IAAA,iCAAc,EAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,CAC/C,IAAI,CAAA;IACL,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACpC,IAAI,IAAI,UAAU,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAA;IACF,OAAO,GAAG,IAAI,IAAI,CAAA;AACpB,CAAC;AArBD,sDAqBC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,aAAsB;IAC7D,IAAI,OAAO,GAAG,CAAC,IAAI,aAAa,EAAE;QAChC,MAAM,SAAS,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;QAC1C,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAA;QACnD,OAAO,aAAa,SAAS,GAAG,UAAU,GAAG,CAAA;KAC9C;IACD,OAAO,EAAE,CAAA;AACX,CAAC","sourcesContent":["import indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport figures from 'figures'\nimport { IColorFns } from '../get_color_fns'\nimport { doesHaveValue, valueOrDefault } from '../../value_checker'\nimport StepDefinitionSnippetBuilder from '../step_definition_snippet_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { formatLocation } from './location_helpers'\nimport {\n IParsedTestStep,\n parseTestCaseAttempt,\n} from './test_case_attempt_parser'\nimport { formatStepArgument } from './step_argument_formatter'\nimport { ITestCaseAttempt } from './event_data_collector'\n\nconst CHARACTERS: Map<messages.TestStepResultStatus, string> = new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, figures.cross],\n [messages.TestStepResultStatus.FAILED, figures.cross],\n [messages.TestStepResultStatus.PASSED, figures.tick],\n [messages.TestStepResultStatus.PENDING, '?'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, '?'],\n])\n\nfunction getStepMessage(testStep: IParsedTestStep): string {\n switch (testStep.result.status) {\n case messages.TestStepResultStatus.AMBIGUOUS:\n case messages.TestStepResultStatus.FAILED:\n return testStep.result.message\n case messages.TestStepResultStatus.UNDEFINED:\n return `${\n 'Undefined. Implement with the following snippet:' + '\\n\\n'\n }${indentString(testStep.snippet, 2)}\\n`\n case messages.TestStepResultStatus.PENDING:\n return 'Pending'\n }\n return ''\n}\n\ninterface IFormatStepRequest {\n colorFns: IColorFns\n testStep: IParsedTestStep\n printAttachments?: boolean\n}\n\nfunction formatStep({\n colorFns,\n testStep,\n printAttachments,\n}: IFormatStepRequest): string {\n const {\n name,\n result: { status },\n actionLocation,\n attachments,\n } = testStep\n const colorFn = colorFns.forStatus(status)\n const identifier = testStep.keyword + valueOrDefault(testStep.text, '')\n let text = colorFn(`${CHARACTERS.get(status)} ${identifier}`)\n if (doesHaveValue(name)) {\n text += colorFn(` (${name})`)\n }\n if (doesHaveValue(actionLocation)) {\n text += ` # ${colorFns.location(formatLocation(actionLocation))}`\n }\n text += '\\n'\n if (doesHaveValue(testStep.argument)) {\n const argumentsText = formatStepArgument(testStep.argument)\n text += indentString(`${colorFn(argumentsText)}\\n`, 4)\n }\n if (valueOrDefault(printAttachments, true)) {\n attachments.forEach(({ body, mediaType, fileName }) => {\n let message = ''\n if (mediaType === 'text/plain') {\n message = `: ${body}`\n } else if (fileName) {\n message = `: ${fileName}`\n }\n text += indentString(`Attachment (${mediaType})${message}\\n`, 4)\n })\n }\n const message = getStepMessage(testStep)\n if (message !== '') {\n text += `${indentString(colorFn(message), 4)}\\n`\n }\n return text\n}\n\nexport interface IFormatTestCaseAttemptRequest {\n colorFns: IColorFns\n testCaseAttempt: ITestCaseAttempt\n snippetBuilder: StepDefinitionSnippetBuilder\n supportCodeLibrary: ISupportCodeLibrary\n printAttachments?: boolean\n}\n\nexport function formatTestCaseAttempt({\n colorFns,\n snippetBuilder,\n supportCodeLibrary,\n testCaseAttempt,\n printAttachments,\n}: IFormatTestCaseAttemptRequest): string {\n const parsed = parseTestCaseAttempt({\n snippetBuilder,\n testCaseAttempt,\n supportCodeLibrary,\n })\n let text = `Scenario: ${parsed.testCase.name}`\n text += getAttemptText(parsed.testCase.attempt, testCaseAttempt.willBeRetried)\n text += ` # ${colorFns.location(\n formatLocation(parsed.testCase.sourceLocation)\n )}\\n`\n parsed.testSteps.forEach((testStep) => {\n text += formatStep({ colorFns, testStep, printAttachments })\n })\n return `${text}\\n`\n}\n\nfunction getAttemptText(attempt: number, willBeRetried: boolean): string {\n if (attempt > 0 || willBeRetried) {\n const numberStr = (attempt + 1).toString()\n const retriedStr = willBeRetried ? ', retried' : ''\n return ` (attempt ${numberStr}${retriedStr})`\n }\n return ''\n}\n"]}
|