@dev-blinq/cucumber-js 1.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/LICENSE +22 -0
- package/README.md +124 -0
- package/api/index.d.ts +6 -0
- package/bin/cucumber-js +3 -0
- package/bin/cucumber.js +3 -0
- package/lib/api/console_logger.d.ts +12 -0
- package/lib/api/console_logger.js +24 -0
- package/lib/api/console_logger.js.map +1 -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 +14 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +20 -0
- package/lib/api/formatters.js +61 -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 +12 -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 +41 -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 +30 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +8 -0
- package/lib/api/paths.js +102 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/plugins.d.ts +4 -0
- package/lib/api/plugins.js +19 -0
- package/lib/api/plugins.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +115 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +21 -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 +26 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/test_helpers.d.ts +3 -0
- package/lib/api/test_helpers.js +36 -0
- package/lib/api/test_helpers.js.map +1 -0
- package/lib/api/types.d.ts +175 -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 +37 -0
- package/lib/cli/helpers.js +203 -0
- package/lib/cli/helpers.js.map +1 -0
- package/lib/cli/i18n.d.ts +2 -0
- package/lib/cli/i18n.js +70 -0
- package/lib/cli/i18n.js.map +1 -0
- package/lib/cli/index.d.ts +21 -0
- package/lib/cli/index.js +59 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/install_validator.d.ts +1 -0
- package/lib/cli/install_validator.js +18 -0
- package/lib/cli/install_validator.js.map +1 -0
- package/lib/cli/run.d.ts +1 -0
- package/lib/cli/run.js +44 -0
- package/lib/cli/run.js.map +1 -0
- 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/configuration/argv_parser.js +102 -0
- 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 +3 -0
- package/lib/configuration/from_file.js +85 -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 +21 -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/configuration/option_splitter.js +23 -0
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +28 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +3 -0
- package/lib/configuration/validate_configuration.js +13 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/filter_stack_trace.d.ts +3 -0
- package/lib/filter_stack_trace.js +38 -0
- package/lib/filter_stack_trace.js.map +1 -0
- package/lib/formatter/builder.d.ts +37 -0
- package/lib/formatter/builder.js +101 -0
- package/lib/formatter/builder.js.map +1 -0
- 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.d.ts +15 -0
- package/lib/formatter/get_color_fns.js +56 -0
- package/lib/formatter/get_color_fns.js.map +1 -0
- package/lib/formatter/helpers/duration_helpers.d.ts +2 -0
- package/lib/formatter/helpers/duration_helpers.js +9 -0
- package/lib/formatter/helpers/duration_helpers.js.map +1 -0
- package/lib/formatter/helpers/event_data_collector.d.ts +30 -0
- package/lib/formatter/helpers/event_data_collector.js +126 -0
- package/lib/formatter/helpers/event_data_collector.js.map +1 -0
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +43 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +66 -0
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -0
- package/lib/formatter/helpers/index.d.ts +10 -0
- package/lib/formatter/helpers/index.js +52 -0
- package/lib/formatter/helpers/index.js.map +1 -0
- package/lib/formatter/helpers/issue_helpers.d.ts +19 -0
- package/lib/formatter/helpers/issue_helpers.js +59 -0
- package/lib/formatter/helpers/issue_helpers.js.map +1 -0
- package/lib/formatter/helpers/keyword_type.d.ts +11 -0
- package/lib/formatter/helpers/keyword_type.js +32 -0
- package/lib/formatter/helpers/keyword_type.js.map +1 -0
- package/lib/formatter/helpers/location_helpers.d.ts +2 -0
- package/lib/formatter/helpers/location_helpers.js +17 -0
- package/lib/formatter/helpers/location_helpers.js.map +1 -0
- package/lib/formatter/helpers/pickle_parser.d.ts +17 -0
- package/lib/formatter/helpers/pickle_parser.js +28 -0
- package/lib/formatter/helpers/pickle_parser.js.map +1 -0
- package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -0
- package/lib/formatter/helpers/step_argument_formatter.js +48 -0
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -0
- package/lib/formatter/helpers/summary_helpers.d.ts +9 -0
- package/lib/formatter/helpers/summary_helpers.js +96 -0
- package/lib/formatter/helpers/summary_helpers.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js +114 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js +135 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -0
- package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -0
- package/lib/formatter/helpers/usage_helpers/index.js +111 -0
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -0
- package/lib/formatter/html_formatter.d.ts +7 -0
- package/lib/formatter/html_formatter.js +30 -0
- package/lib/formatter/html_formatter.js.map +1 -0
- package/lib/formatter/index.d.ts +53 -0
- package/lib/formatter/index.js +21 -0
- package/lib/formatter/index.js.map +1 -0
- package/lib/formatter/json_formatter.d.ts +78 -0
- package/lib/formatter/json_formatter.js +230 -0
- package/lib/formatter/json_formatter.js.map +1 -0
- package/lib/formatter/junit_formatter.d.ts +17 -0
- package/lib/formatter/junit_formatter.js +181 -0
- package/lib/formatter/junit_formatter.js.map +1 -0
- package/lib/formatter/message_formatter.d.ts +5 -0
- package/lib/formatter/message_formatter.js +15 -0
- package/lib/formatter/message_formatter.js.map +1 -0
- package/lib/formatter/progress_bar_formatter.d.ts +18 -0
- package/lib/formatter/progress_bar_formatter.js +99 -0
- package/lib/formatter/progress_bar_formatter.js.map +1 -0
- package/lib/formatter/progress_formatter.d.ts +9 -0
- package/lib/formatter/progress_formatter.js +59 -0
- package/lib/formatter/progress_formatter.js.map +1 -0
- package/lib/formatter/rerun_formatter.d.ts +13 -0
- package/lib/formatter/rerun_formatter.js +80 -0
- package/lib/formatter/rerun_formatter.js.map +1 -0
- package/lib/formatter/snippets_formatter.d.ts +6 -0
- package/lib/formatter/snippets_formatter.js +61 -0
- package/lib/formatter/snippets_formatter.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -0
- package/lib/formatter/step_definition_snippet_builder/index.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +11 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -0
- package/lib/formatter/summary_formatter.d.ts +14 -0
- package/lib/formatter/summary_formatter.js +68 -0
- package/lib/formatter/summary_formatter.js.map +1 -0
- package/lib/formatter/usage_formatter.d.ts +6 -0
- package/lib/formatter/usage_formatter.js +98 -0
- package/lib/formatter/usage_formatter.js.map +1 -0
- package/lib/formatter/usage_json_formatter.d.ts +7 -0
- package/lib/formatter/usage_json_formatter.js +34 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -0
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.js +109 -0
- package/lib/index.js.map +1 -0
- package/lib/logger.d.ts +5 -0
- package/lib/logger.js +3 -0
- package/lib/logger.js.map +1 -0
- package/lib/models/data_table.d.ts +10 -0
- package/lib/models/data_table.js +46 -0
- package/lib/models/data_table.js.map +1 -0
- package/lib/models/definition.d.ts +55 -0
- package/lib/models/definition.js +22 -0
- package/lib/models/definition.js.map +1 -0
- package/lib/models/gherkin_step_keyword.d.ts +1 -0
- package/lib/models/gherkin_step_keyword.js +3 -0
- package/lib/models/gherkin_step_keyword.js.map +1 -0
- 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.d.ts +11 -0
- package/lib/models/step_definition.js +37 -0
- package/lib/models/step_definition.js.map +1 -0
- package/lib/models/test_case_hook_definition.d.ts +10 -0
- package/lib/models/test_case_hook_definition.js +27 -0
- package/lib/models/test_case_hook_definition.js.map +1 -0
- package/lib/models/test_run_hook_definition.d.ts +3 -0
- package/lib/models/test_run_hook_definition.js +10 -0
- package/lib/models/test_run_hook_definition.js.map +1 -0
- package/lib/models/test_step_hook_definition.d.ts +9 -0
- package/lib/models/test_step_hook_definition.js +26 -0
- package/lib/models/test_step_hook_definition.js.map +1 -0
- package/lib/pickle_filter.d.ts +42 -0
- package/lib/pickle_filter.js +99 -0
- package/lib/pickle_filter.js.map +1 -0
- package/lib/plugin/index.d.ts +2 -0
- package/lib/plugin/index.js +19 -0
- package/lib/plugin/index.js.map +1 -0
- package/lib/plugin/plugin_manager.d.ts +13 -0
- package/lib/plugin/plugin_manager.js +36 -0
- package/lib/plugin/plugin_manager.js.map +1 -0
- package/lib/plugin/types.d.ts +14 -0
- package/lib/plugin/types.js +3 -0
- package/lib/plugin/types.js.map +1 -0
- package/lib/publish/http_stream.d.ts +30 -0
- package/lib/publish/http_stream.js +112 -0
- package/lib/publish/http_stream.js.map +1 -0
- package/lib/publish/index.d.ts +2 -0
- package/lib/publish/index.js +5 -0
- package/lib/publish/index.js.map +1 -0
- package/lib/publish/publish_plugin.d.ts +2 -0
- package/lib/publish/publish_plugin.js +48 -0
- package/lib/publish/publish_plugin.js.map +1 -0
- package/lib/runtime/assemble_test_cases.d.ts +13 -0
- package/lib/runtime/assemble_test_cases.js +88 -0
- package/lib/runtime/assemble_test_cases.js.map +1 -0
- package/lib/runtime/attachment_manager/index.d.ts +33 -0
- package/lib/runtime/attachment_manager/index.js +119 -0
- package/lib/runtime/attachment_manager/index.js.map +1 -0
- package/lib/runtime/format_error.d.ts +2 -0
- package/lib/runtime/format_error.js +36 -0
- package/lib/runtime/format_error.js.map +1 -0
- package/lib/runtime/helpers.d.ts +6 -0
- package/lib/runtime/helpers.js +101 -0
- package/lib/runtime/helpers.js.map +1 -0
- package/lib/runtime/index.d.ts +40 -0
- package/lib/runtime/index.js +76 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/parallel/command_types.d.ts +32 -0
- package/lib/runtime/parallel/command_types.js +3 -0
- package/lib/runtime/parallel/command_types.js.map +1 -0
- package/lib/runtime/parallel/coordinator.d.ts +72 -0
- package/lib/runtime/parallel/coordinator.js +222 -0
- package/lib/runtime/parallel/coordinator.js.map +1 -0
- package/lib/runtime/parallel/run_worker.d.ts +1 -0
- package/lib/runtime/parallel/run_worker.js +29 -0
- package/lib/runtime/parallel/run_worker.js.map +1 -0
- package/lib/runtime/parallel/worker.d.ts +26 -0
- package/lib/runtime/parallel/worker.js +87 -0
- package/lib/runtime/parallel/worker.js.map +1 -0
- 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.d.ts +16 -0
- package/lib/runtime/step_runner.js +88 -0
- package/lib/runtime/step_runner.js.map +1 -0
- package/lib/runtime/stopwatch.d.ts +12 -0
- package/lib/runtime/stopwatch.js +34 -0
- package/lib/runtime/stopwatch.js.map +1 -0
- package/lib/runtime/test_case_runner.d.ts +54 -0
- package/lib/runtime/test_case_runner.js +268 -0
- package/lib/runtime/test_case_runner.js.map +1 -0
- package/lib/step_arguments.d.ts +6 -0
- package/lib/step_arguments.js +19 -0
- package/lib/step_arguments.js.map +1 -0
- package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -0
- 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 +29 -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 +74 -0
- package/lib/support_code_library_builder/index.js +304 -0
- package/lib/support_code_library_builder/index.js.map +1 -0
- 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/sourced_parameter_type_registry.d.ts +7 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +19 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +88 -0
- package/lib/support_code_library_builder/types.js +3 -0
- package/lib/support_code_library_builder/types.js.map +1 -0
- package/lib/support_code_library_builder/validate_arguments.d.ts +12 -0
- package/lib/support_code_library_builder/validate_arguments.js +73 -0
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -0
- package/lib/support_code_library_builder/world.d.ts +18 -0
- package/lib/support_code_library_builder/world.js +11 -0
- package/lib/support_code_library_builder/world.js.map +1 -0
- package/lib/time.d.ts +18 -0
- package/lib/time.js +61 -0
- package/lib/time.js.map +1 -0
- package/lib/try_require.d.ts +7 -0
- package/lib/try_require.js +26 -0
- package/lib/try_require.js.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib/uncaught_exception_manager.d.ts +7 -0
- package/lib/uncaught_exception_manager.js +12 -0
- package/lib/uncaught_exception_manager.js.map +1 -0
- package/lib/user_code_runner.d.ts +14 -0
- package/lib/user_code_runner.js +82 -0
- package/lib/user_code_runner.js.map +1 -0
- package/lib/value_checker.d.ts +3 -0
- package/lib/value_checker.js +19 -0
- package/lib/value_checker.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +44 -0
- package/package.json +189 -0
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
const json_formatter_1 = __importDefault(require("../json_formatter"));
|
|
7
|
+
const message_formatter_1 = __importDefault(require("../message_formatter"));
|
|
8
|
+
const progress_bar_formatter_1 = __importDefault(require("../progress_bar_formatter"));
|
|
9
|
+
const progress_formatter_1 = __importDefault(require("../progress_formatter"));
|
|
10
|
+
const rerun_formatter_1 = __importDefault(require("../rerun_formatter"));
|
|
11
|
+
const snippets_formatter_1 = __importDefault(require("../snippets_formatter"));
|
|
12
|
+
const summary_formatter_1 = __importDefault(require("../summary_formatter"));
|
|
13
|
+
const usage_formatter_1 = __importDefault(require("../usage_formatter"));
|
|
14
|
+
const usage_json_formatter_1 = __importDefault(require("../usage_json_formatter"));
|
|
15
|
+
const html_formatter_1 = __importDefault(require("../html_formatter"));
|
|
16
|
+
const junit_formatter_1 = __importDefault(require("../junit_formatter"));
|
|
17
|
+
const Formatters = {
|
|
18
|
+
getFormatters() {
|
|
19
|
+
return {
|
|
20
|
+
json: json_formatter_1.default,
|
|
21
|
+
message: message_formatter_1.default,
|
|
22
|
+
html: html_formatter_1.default,
|
|
23
|
+
progress: progress_formatter_1.default,
|
|
24
|
+
'progress-bar': progress_bar_formatter_1.default,
|
|
25
|
+
rerun: rerun_formatter_1.default,
|
|
26
|
+
snippets: snippets_formatter_1.default,
|
|
27
|
+
summary: summary_formatter_1.default,
|
|
28
|
+
usage: usage_formatter_1.default,
|
|
29
|
+
'usage-json': usage_json_formatter_1.default,
|
|
30
|
+
junit: junit_formatter_1.default,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
buildFormattersDocumentationString() {
|
|
34
|
+
let concatanatedFormattersDocumentation = '';
|
|
35
|
+
const formatters = this.getFormatters();
|
|
36
|
+
for (const formatterName in formatters) {
|
|
37
|
+
concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\n`;
|
|
38
|
+
}
|
|
39
|
+
return concatanatedFormattersDocumentation;
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.default = Formatters;
|
|
43
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../../src/formatter/helpers/formatters.ts"],"names":[],"mappings":";;;;;AACA,uEAA6C;AAC7C,6EAAmD;AACnD,uFAA4D;AAC5D,+EAAqD;AACrD,yEAA+C;AAC/C,+EAAqD;AACrD,6EAAmD;AACnD,yEAA+C;AAC/C,mFAAwD;AACxD,uEAA6C;AAC7C,yEAA+C;AAE/C,MAAM,UAAU,GAAG;IACjB,aAAa;QACX,OAAO;YACL,IAAI,EAAE,wBAAa;YACnB,OAAO,EAAE,2BAAgB;YACzB,IAAI,EAAE,wBAAa;YACnB,QAAQ,EAAE,4BAAiB;YAC3B,cAAc,EAAE,gCAAoB;YACpC,KAAK,EAAE,yBAAc;YACrB,QAAQ,EAAE,4BAAiB;YAC3B,OAAO,EAAE,2BAAgB;YACzB,KAAK,EAAE,yBAAc;YACrB,YAAY,EAAE,8BAAkB;YAChC,KAAK,EAAE,yBAAc;SACtB,CAAA;IACH,CAAC;IACD,kCAAkC;QAChC,IAAI,mCAAmC,GAAW,EAAE,CAAA;QACpD,MAAM,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAA;QACvC,KAAK,MAAM,aAAa,IAAI,UAAU,EAAE;YACtC,mCAAmC,IAAI,OAAO,aAAa,KAAK,UAAU,CAAC,aAAa,CAAC,CAAC,aAAa,IAAI,CAAA;SAC5G;QAED,OAAO,mCAAmC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,UAAU,CAAA","sourcesContent":["import Formatter from '../.'\nimport JsonFormatter from '../json_formatter'\nimport MessageFormatter from '../message_formatter'\nimport ProgressBarFormatter from '../progress_bar_formatter'\nimport ProgressFormatter from '../progress_formatter'\nimport RerunFormatter from '../rerun_formatter'\nimport SnippetsFormatter from '../snippets_formatter'\nimport SummaryFormatter from '../summary_formatter'\nimport UsageFormatter from '../usage_formatter'\nimport UsageJsonFormatter from '../usage_json_formatter'\nimport HtmlFormatter from '../html_formatter'\nimport JunitFormatter from '../junit_formatter'\n\nconst Formatters = {\n getFormatters(): Record<string, typeof Formatter> {\n return {\n json: JsonFormatter,\n message: MessageFormatter,\n html: HtmlFormatter,\n progress: ProgressFormatter,\n 'progress-bar': ProgressBarFormatter,\n rerun: RerunFormatter,\n snippets: SnippetsFormatter,\n summary: SummaryFormatter,\n usage: UsageFormatter,\n 'usage-json': UsageJsonFormatter,\n junit: JunitFormatter,\n }\n },\n buildFormattersDocumentationString(): string {\n let concatanatedFormattersDocumentation: string = ''\n const formatters = this.getFormatters()\n for (const formatterName in formatters) {\n concatanatedFormattersDocumentation += ` ${formatterName}: ${formatters[formatterName].documentation}\\n`\n }\n\n return concatanatedFormattersDocumentation\n },\n}\n\nexport default Formatters\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
export declare function getGherkinStepMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Step>;
|
|
3
|
+
export declare function getGherkinScenarioMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Scenario>;
|
|
4
|
+
export declare function getGherkinExampleRuleMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Rule>;
|
|
5
|
+
export declare function getGherkinScenarioLocationMap(gherkinDocument: messages.GherkinDocument): Record<string, messages.Location>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGherkinScenarioLocationMap = exports.getGherkinExampleRuleMap = exports.getGherkinScenarioMap = exports.getGherkinStepMap = void 0;
|
|
4
|
+
const value_checker_1 = require("../../value_checker");
|
|
5
|
+
function getGherkinStepMap(gherkinDocument) {
|
|
6
|
+
const result = {};
|
|
7
|
+
gherkinDocument.feature.children
|
|
8
|
+
.map(extractStepContainers)
|
|
9
|
+
.flat()
|
|
10
|
+
.forEach((x) => x.steps.forEach((step) => (result[step.id] = step)));
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
exports.getGherkinStepMap = getGherkinStepMap;
|
|
14
|
+
function extractStepContainers(child) {
|
|
15
|
+
if ((0, value_checker_1.doesHaveValue)(child.background)) {
|
|
16
|
+
return [child.background];
|
|
17
|
+
}
|
|
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
|
+
? ruleChild.background
|
|
21
|
+
: ruleChild.scenario);
|
|
22
|
+
}
|
|
23
|
+
return [child.scenario];
|
|
24
|
+
}
|
|
25
|
+
function getGherkinScenarioMap(gherkinDocument) {
|
|
26
|
+
const result = {};
|
|
27
|
+
gherkinDocument.feature.children
|
|
28
|
+
.map((child) => {
|
|
29
|
+
if ((0, value_checker_1.doesHaveValue)(child.rule)) {
|
|
30
|
+
return child.rule.children;
|
|
31
|
+
}
|
|
32
|
+
return [child];
|
|
33
|
+
})
|
|
34
|
+
.flat()
|
|
35
|
+
.forEach((x) => {
|
|
36
|
+
if (x.scenario != null) {
|
|
37
|
+
result[x.scenario.id] = x.scenario;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
exports.getGherkinScenarioMap = getGherkinScenarioMap;
|
|
43
|
+
function getGherkinExampleRuleMap(gherkinDocument) {
|
|
44
|
+
const result = {};
|
|
45
|
+
gherkinDocument.feature.children
|
|
46
|
+
.filter((x) => x.rule != null)
|
|
47
|
+
.forEach((x) => x.rule.children
|
|
48
|
+
.filter((child) => (0, value_checker_1.doesHaveValue)(child.scenario))
|
|
49
|
+
.forEach((child) => (result[child.scenario.id] = x.rule)));
|
|
50
|
+
return result;
|
|
51
|
+
}
|
|
52
|
+
exports.getGherkinExampleRuleMap = getGherkinExampleRuleMap;
|
|
53
|
+
function getGherkinScenarioLocationMap(gherkinDocument) {
|
|
54
|
+
const locationMap = {};
|
|
55
|
+
const scenarioMap = getGherkinScenarioMap(gherkinDocument);
|
|
56
|
+
Object.keys(scenarioMap).forEach((id) => {
|
|
57
|
+
const scenario = scenarioMap[id];
|
|
58
|
+
locationMap[id] = scenario.location;
|
|
59
|
+
if ((0, value_checker_1.doesHaveValue)(scenario.examples)) {
|
|
60
|
+
scenario.examples.forEach((x) => x.tableBody.forEach((tableRow) => (locationMap[tableRow.id] = tableRow.location)));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return locationMap;
|
|
64
|
+
}
|
|
65
|
+
exports.getGherkinScenarioLocationMap = getGherkinScenarioLocationMap;
|
|
66
|
+
//# sourceMappingURL=gherkin_document_parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gherkin_document_parser.js","sourceRoot":"","sources":["../../../src/format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IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACpC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAC9B,CAAC,CAAC,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"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as GherkinDocumentParser from './gherkin_document_parser';
|
|
2
|
+
import * as PickleParser from './pickle_parser';
|
|
3
|
+
export { parseTestCaseAttempt } from './test_case_attempt_parser';
|
|
4
|
+
export { default as EventDataCollector } from './event_data_collector';
|
|
5
|
+
export { KeywordType, getStepKeywordType } from './keyword_type';
|
|
6
|
+
export { formatIssue, isWarning, isFailure, isIssue } from './issue_helpers';
|
|
7
|
+
export { formatLocation } from './location_helpers';
|
|
8
|
+
export { formatSummary } from './summary_helpers';
|
|
9
|
+
export { getUsage } from './usage_helpers';
|
|
10
|
+
export { GherkinDocumentParser, PickleParser };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.PickleParser = exports.GherkinDocumentParser = exports.getUsage = exports.formatSummary = exports.formatLocation = exports.isIssue = exports.isFailure = exports.isWarning = exports.formatIssue = exports.getStepKeywordType = exports.KeywordType = exports.EventDataCollector = exports.parseTestCaseAttempt = void 0;
|
|
30
|
+
const GherkinDocumentParser = __importStar(require("./gherkin_document_parser"));
|
|
31
|
+
exports.GherkinDocumentParser = GherkinDocumentParser;
|
|
32
|
+
const PickleParser = __importStar(require("./pickle_parser"));
|
|
33
|
+
exports.PickleParser = PickleParser;
|
|
34
|
+
var test_case_attempt_parser_1 = require("./test_case_attempt_parser");
|
|
35
|
+
Object.defineProperty(exports, "parseTestCaseAttempt", { enumerable: true, get: function () { return test_case_attempt_parser_1.parseTestCaseAttempt; } });
|
|
36
|
+
var event_data_collector_1 = require("./event_data_collector");
|
|
37
|
+
Object.defineProperty(exports, "EventDataCollector", { enumerable: true, get: function () { return __importDefault(event_data_collector_1).default; } });
|
|
38
|
+
var keyword_type_1 = require("./keyword_type");
|
|
39
|
+
Object.defineProperty(exports, "KeywordType", { enumerable: true, get: function () { return keyword_type_1.KeywordType; } });
|
|
40
|
+
Object.defineProperty(exports, "getStepKeywordType", { enumerable: true, get: function () { return keyword_type_1.getStepKeywordType; } });
|
|
41
|
+
var issue_helpers_1 = require("./issue_helpers");
|
|
42
|
+
Object.defineProperty(exports, "formatIssue", { enumerable: true, get: function () { return issue_helpers_1.formatIssue; } });
|
|
43
|
+
Object.defineProperty(exports, "isWarning", { enumerable: true, get: function () { return issue_helpers_1.isWarning; } });
|
|
44
|
+
Object.defineProperty(exports, "isFailure", { enumerable: true, get: function () { return issue_helpers_1.isFailure; } });
|
|
45
|
+
Object.defineProperty(exports, "isIssue", { enumerable: true, get: function () { return issue_helpers_1.isIssue; } });
|
|
46
|
+
var location_helpers_1 = require("./location_helpers");
|
|
47
|
+
Object.defineProperty(exports, "formatLocation", { enumerable: true, get: function () { return location_helpers_1.formatLocation; } });
|
|
48
|
+
var summary_helpers_1 = require("./summary_helpers");
|
|
49
|
+
Object.defineProperty(exports, "formatSummary", { enumerable: true, get: function () { return summary_helpers_1.formatSummary; } });
|
|
50
|
+
var usage_helpers_1 = require("./usage_helpers");
|
|
51
|
+
Object.defineProperty(exports, "getUsage", { enumerable: true, get: function () { return usage_helpers_1.getUsage; } });
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
import { IColorFns } from '../get_color_fns';
|
|
3
|
+
import StepDefinitionSnippetBuilder from '../step_definition_snippet_builder';
|
|
4
|
+
import { ISupportCodeLibrary } from '../../support_code_library_builder/types';
|
|
5
|
+
import { ITestCaseAttempt } from './event_data_collector';
|
|
6
|
+
export declare function isFailure(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
|
|
7
|
+
export declare function isWarning(result: messages.TestStepResult, willBeRetried?: boolean): boolean;
|
|
8
|
+
export declare function isIssue(result: messages.TestStepResult): boolean;
|
|
9
|
+
export interface IFormatIssueRequest {
|
|
10
|
+
colorFns: IColorFns;
|
|
11
|
+
number: number;
|
|
12
|
+
snippetBuilder: StepDefinitionSnippetBuilder;
|
|
13
|
+
testCaseAttempt: ITestCaseAttempt;
|
|
14
|
+
supportCodeLibrary: ISupportCodeLibrary;
|
|
15
|
+
printAttachments?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments, }: IFormatIssueRequest): string;
|
|
18
|
+
export declare function formatUndefinedParameterTypes(undefinedParameterTypes: messages.UndefinedParameterType[]): string;
|
|
19
|
+
export declare function formatUndefinedParameterType(parameterType: messages.UndefinedParameterType): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
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.formatUndefinedParameterType = exports.formatUndefinedParameterTypes = exports.formatIssue = exports.isIssue = exports.isWarning = exports.isFailure = void 0;
|
|
7
|
+
const indent_string_1 = __importDefault(require("indent-string"));
|
|
8
|
+
const test_case_attempt_formatter_1 = require("./test_case_attempt_formatter");
|
|
9
|
+
function isFailure(result, willBeRetried = false) {
|
|
10
|
+
return (result.status === 'AMBIGUOUS' ||
|
|
11
|
+
result.status === 'UNDEFINED' ||
|
|
12
|
+
(result.status === 'FAILED' && !willBeRetried));
|
|
13
|
+
}
|
|
14
|
+
exports.isFailure = isFailure;
|
|
15
|
+
function isWarning(result, willBeRetried = false) {
|
|
16
|
+
return (result.status === 'PENDING' || (result.status === 'FAILED' && willBeRetried));
|
|
17
|
+
}
|
|
18
|
+
exports.isWarning = isWarning;
|
|
19
|
+
function isIssue(result) {
|
|
20
|
+
return isFailure(result) || isWarning(result);
|
|
21
|
+
}
|
|
22
|
+
exports.isIssue = isIssue;
|
|
23
|
+
function formatIssue({ colorFns, number, snippetBuilder, testCaseAttempt, supportCodeLibrary, printAttachments = true, }) {
|
|
24
|
+
const prefix = `${number.toString()}) `;
|
|
25
|
+
const formattedTestCaseAttempt = (0, test_case_attempt_formatter_1.formatTestCaseAttempt)({
|
|
26
|
+
colorFns,
|
|
27
|
+
snippetBuilder,
|
|
28
|
+
testCaseAttempt,
|
|
29
|
+
supportCodeLibrary,
|
|
30
|
+
printAttachments,
|
|
31
|
+
});
|
|
32
|
+
const lines = formattedTestCaseAttempt.split('\n');
|
|
33
|
+
const updatedLines = lines.map((line, index) => {
|
|
34
|
+
if (index === 0) {
|
|
35
|
+
return `${prefix}${line}`;
|
|
36
|
+
}
|
|
37
|
+
return (0, indent_string_1.default)(line, prefix.length);
|
|
38
|
+
});
|
|
39
|
+
return updatedLines.join('\n');
|
|
40
|
+
}
|
|
41
|
+
exports.formatIssue = formatIssue;
|
|
42
|
+
function formatUndefinedParameterTypes(undefinedParameterTypes) {
|
|
43
|
+
const output = [`Undefined parameter types:\n\n`];
|
|
44
|
+
const withLatest = {};
|
|
45
|
+
undefinedParameterTypes.forEach((parameterType) => {
|
|
46
|
+
withLatest[parameterType.name] = parameterType;
|
|
47
|
+
});
|
|
48
|
+
output.push(Object.values(withLatest)
|
|
49
|
+
.map((parameterType) => `- ${formatUndefinedParameterType(parameterType)}`)
|
|
50
|
+
.join('\n'));
|
|
51
|
+
output.push('\n\n');
|
|
52
|
+
return output.join('');
|
|
53
|
+
}
|
|
54
|
+
exports.formatUndefinedParameterTypes = formatUndefinedParameterTypes;
|
|
55
|
+
function formatUndefinedParameterType(parameterType) {
|
|
56
|
+
return `"${parameterType.name}" e.g. \`${parameterType.expression}\``;
|
|
57
|
+
}
|
|
58
|
+
exports.formatUndefinedParameterType = formatUndefinedParameterType;
|
|
59
|
+
//# sourceMappingURL=issue_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"issue_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/issue_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAwC;AACxC,+EAAqE;AAOrE,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,8B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Aa,EAAE,EAAE;QAChD,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,aAAa,CAAA;IAChD,CAAC,CAAC,CAAA;IACF,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC;SACtB,GAAG,CACF,CAAC,aAAa,EAAE,EAAE,CAAC,KAAK,4BAA4B,CAAC,aAAa,CAAC,EAAE,CACtE;SACA,IAAI,CAAC,IAAI,CAAC,CACd,CAAA;IACD,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACnB,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AACxB,CAAC;AAjBD,sEAiBC;AAED,SAAgB,4BAA4B,CAC1C,aAA8C;IAE9C,OAAO,IAAI,aAAa,CAAC,IAAI,YAAY,aAAa,CAAC,UAAU,IAAI,CAAA;AACvE,CAAC;AAJD,oEAIC","sourcesContent":["import indentString from 'indent-string'\nimport { formatTestCaseAttempt } from './test_case_attempt_formatter'\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 { 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"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum KeywordType {
|
|
2
|
+
Precondition = "precondition",
|
|
3
|
+
Event = "event",
|
|
4
|
+
Outcome = "outcome"
|
|
5
|
+
}
|
|
6
|
+
export interface IGetStepKeywordTypeOptions {
|
|
7
|
+
keyword: string;
|
|
8
|
+
language: string;
|
|
9
|
+
previousKeywordType?: KeywordType;
|
|
10
|
+
}
|
|
11
|
+
export declare function getStepKeywordType({ keyword, language, previousKeywordType, }: IGetStepKeywordTypeOptions): KeywordType;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getStepKeywordType = exports.KeywordType = void 0;
|
|
4
|
+
const gherkin_1 = require("@cucumber/gherkin");
|
|
5
|
+
const value_checker_1 = require("../../value_checker");
|
|
6
|
+
var KeywordType;
|
|
7
|
+
(function (KeywordType) {
|
|
8
|
+
KeywordType["Precondition"] = "precondition";
|
|
9
|
+
KeywordType["Event"] = "event";
|
|
10
|
+
KeywordType["Outcome"] = "outcome";
|
|
11
|
+
})(KeywordType = exports.KeywordType || (exports.KeywordType = {}));
|
|
12
|
+
function getStepKeywordType({ keyword, language, previousKeywordType, }) {
|
|
13
|
+
const dialect = gherkin_1.dialects[language];
|
|
14
|
+
const stepKeywords = ['given', 'when', 'then', 'and', 'but'];
|
|
15
|
+
const type = stepKeywords.find((key) => dialect[key].includes(keyword));
|
|
16
|
+
switch (type) {
|
|
17
|
+
case 'when':
|
|
18
|
+
return KeywordType.Event;
|
|
19
|
+
case 'then':
|
|
20
|
+
return KeywordType.Outcome;
|
|
21
|
+
case 'and':
|
|
22
|
+
case 'but':
|
|
23
|
+
if ((0, value_checker_1.doesHaveValue)(previousKeywordType)) {
|
|
24
|
+
return previousKeywordType;
|
|
25
|
+
}
|
|
26
|
+
// fallthrough
|
|
27
|
+
default:
|
|
28
|
+
return KeywordType.Precondition;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.getStepKeywordType = getStepKeywordType;
|
|
32
|
+
//# sourceMappingURL=keyword_type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword_type.js","sourceRoot":"","sources":["../../../src/formatter/helpers/keyword_type.ts"],"names":[],"mappings":";;;AAAA,+CAAqD;AACrD,uDAAmD;AAEnD,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAQD,SAAgB,kBAAkB,CAAC,EACjC,OAAO,EACP,QAAQ,EACR,mBAAmB,GACQ;IAC3B,MAAM,OAAO,GAAY,kBAAQ,CAAC,QAAQ,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAU,CAAA;IACrE,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IACvE,QAAQ,IAAI,EAAE;QACZ,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,MAAM;YACT,OAAO,WAAW,CAAC,OAAO,CAAA;QAC5B,KAAK,KAAK,CAAC;QACX,KAAK,KAAK;YACR,IAAI,IAAA,6BAAa,EAAC,mBAAmB,CAAC,EAAE;gBACtC,OAAO,mBAAmB,CAAA;aAC3B;QACH,cAAc;QACd;YACE,OAAO,WAAW,CAAC,YAAY,CAAA;KAClC;AACH,CAAC;AAtBD,gDAsBC","sourcesContent":["import { Dialect, dialects } from '@cucumber/gherkin'\nimport { doesHaveValue } from '../../value_checker'\n\nexport enum KeywordType {\n Precondition = 'precondition',\n Event = 'event',\n Outcome = 'outcome',\n}\n\nexport interface IGetStepKeywordTypeOptions {\n keyword: string\n language: string\n previousKeywordType?: KeywordType\n}\n\nexport function getStepKeywordType({\n keyword,\n language,\n previousKeywordType,\n}: IGetStepKeywordTypeOptions): KeywordType {\n const dialect: Dialect = dialects[language]\n const stepKeywords = ['given', 'when', 'then', 'and', 'but'] as const\n const type = stepKeywords.find((key) => dialect[key].includes(keyword))\n switch (type) {\n case 'when':\n return KeywordType.Event\n case 'then':\n return KeywordType.Outcome\n case 'and':\n case 'but':\n if (doesHaveValue(previousKeywordType)) {\n return previousKeywordType\n }\n // fallthrough\n default:\n return KeywordType.Precondition\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
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.formatLocation = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const value_checker_1 = require("../../value_checker");
|
|
9
|
+
function formatLocation(obj, cwd) {
|
|
10
|
+
let uri = obj.uri;
|
|
11
|
+
if ((0, value_checker_1.doesHaveValue)(cwd)) {
|
|
12
|
+
uri = path_1.default.relative(cwd, uri);
|
|
13
|
+
}
|
|
14
|
+
return `${uri}:${obj.line.toString()}`;
|
|
15
|
+
}
|
|
16
|
+
exports.formatLocation = formatLocation;
|
|
17
|
+
//# sourceMappingURL=location_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/location_helpers.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,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,cAAI,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 '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"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
export interface IGetPickleLocationRequest {
|
|
3
|
+
gherkinDocument: messages.GherkinDocument;
|
|
4
|
+
pickle: messages.Pickle;
|
|
5
|
+
}
|
|
6
|
+
export interface IGetStepKeywordRequest {
|
|
7
|
+
pickleStep: messages.PickleStep;
|
|
8
|
+
gherkinStepMap: Record<string, messages.Step>;
|
|
9
|
+
}
|
|
10
|
+
export interface IGetScenarioDescriptionRequest {
|
|
11
|
+
pickle: messages.Pickle;
|
|
12
|
+
gherkinScenarioMap: Record<string, messages.Scenario>;
|
|
13
|
+
}
|
|
14
|
+
export declare function getScenarioDescription({ pickle, gherkinScenarioMap, }: IGetScenarioDescriptionRequest): string;
|
|
15
|
+
export declare function getStepKeyword({ pickleStep, gherkinStepMap, }: IGetStepKeywordRequest): string;
|
|
16
|
+
export declare function getPickleStepMap(pickle: messages.Pickle): Record<string, messages.PickleStep>;
|
|
17
|
+
export declare function getPickleLocation({ gherkinDocument, pickle, }: IGetPickleLocationRequest): messages.Location;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPickleLocation = exports.getPickleStepMap = exports.getStepKeyword = exports.getScenarioDescription = void 0;
|
|
4
|
+
const gherkin_document_parser_1 = require("./gherkin_document_parser");
|
|
5
|
+
function getScenarioDescription({ pickle, gherkinScenarioMap, }) {
|
|
6
|
+
return pickle.astNodeIds
|
|
7
|
+
.map((id) => gherkinScenarioMap[id])
|
|
8
|
+
.filter((x) => x != null)[0].description;
|
|
9
|
+
}
|
|
10
|
+
exports.getScenarioDescription = getScenarioDescription;
|
|
11
|
+
function getStepKeyword({ pickleStep, gherkinStepMap, }) {
|
|
12
|
+
return pickleStep.astNodeIds
|
|
13
|
+
.map((id) => gherkinStepMap[id])
|
|
14
|
+
.filter((x) => x != null)[0].keyword;
|
|
15
|
+
}
|
|
16
|
+
exports.getStepKeyword = getStepKeyword;
|
|
17
|
+
function getPickleStepMap(pickle) {
|
|
18
|
+
const result = {};
|
|
19
|
+
pickle.steps.forEach((pickleStep) => (result[pickleStep.id] = pickleStep));
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
exports.getPickleStepMap = getPickleStepMap;
|
|
23
|
+
function getPickleLocation({ gherkinDocument, pickle, }) {
|
|
24
|
+
const gherkinScenarioLocationMap = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument);
|
|
25
|
+
return gherkinScenarioLocationMap[pickle.astNodeIds[pickle.astNodeIds.length - 1]];
|
|
26
|
+
}
|
|
27
|
+
exports.getPickleLocation = getPickleLocation;
|
|
28
|
+
//# sourceMappingURL=pickle_parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pickle_parser.js","sourceRoot":"","sources":["../../../src/formatter/helpers/pickle_parser.ts"],"names":[],"mappings":";;;AAAA,uEAAyE;AAkBzE,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 { getGherkinScenarioLocationMap } from './gherkin_document_parser'\nimport * as messages from '@cucumber/messages'\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"]}
|
|
@@ -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.formatStepArgument = void 0;
|
|
7
|
+
const cli_table3_1 = __importDefault(require("cli-table3"));
|
|
8
|
+
const step_arguments_1 = require("../../step_arguments");
|
|
9
|
+
function formatDataTable(dataTable) {
|
|
10
|
+
const table = new cli_table3_1.default({
|
|
11
|
+
chars: {
|
|
12
|
+
bottom: '',
|
|
13
|
+
'bottom-left': '',
|
|
14
|
+
'bottom-mid': '',
|
|
15
|
+
'bottom-right': '',
|
|
16
|
+
left: '|',
|
|
17
|
+
'left-mid': '',
|
|
18
|
+
mid: '',
|
|
19
|
+
'mid-mid': '',
|
|
20
|
+
middle: '|',
|
|
21
|
+
right: '|',
|
|
22
|
+
'right-mid': '',
|
|
23
|
+
top: '',
|
|
24
|
+
'top-left': '',
|
|
25
|
+
'top-mid': '',
|
|
26
|
+
'top-right': '',
|
|
27
|
+
},
|
|
28
|
+
style: {
|
|
29
|
+
border: [],
|
|
30
|
+
'padding-left': 1,
|
|
31
|
+
'padding-right': 1,
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const rows = dataTable.rows.map((row) => row.cells.map((cell) => cell.value.replace(/\\/g, '\\\\').replace(/\n/g, '\\n')));
|
|
35
|
+
table.push(...rows);
|
|
36
|
+
return table.toString();
|
|
37
|
+
}
|
|
38
|
+
function formatDocString(docString) {
|
|
39
|
+
return `"""\n${docString.content}\n"""`;
|
|
40
|
+
}
|
|
41
|
+
function formatStepArgument(arg) {
|
|
42
|
+
return (0, step_arguments_1.parseStepArgument)(arg, {
|
|
43
|
+
dataTable: formatDataTable,
|
|
44
|
+
docString: formatDocString,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.formatStepArgument = formatStepArgument;
|
|
48
|
+
//# sourceMappingURL=step_argument_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step_argument_formatter.js","sourceRoot":"","sources":["../../../src/formatter/helpers/step_argument_formatter.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA8B;AAC9B,yDAAwD;AAGxD,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 { parseStepArgument } from '../../step_arguments'\nimport * as messages from '@cucumber/messages'\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"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IColorFns } from '../get_color_fns';
|
|
2
|
+
import { ITestCaseAttempt } from './event_data_collector';
|
|
3
|
+
import * as messages from '@cucumber/messages';
|
|
4
|
+
export interface IFormatSummaryRequest {
|
|
5
|
+
colorFns: IColorFns;
|
|
6
|
+
testCaseAttempts: ITestCaseAttempt[];
|
|
7
|
+
testRunDuration: messages.Duration;
|
|
8
|
+
}
|
|
9
|
+
export declare function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }: IFormatSummaryRequest): string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.formatSummary = void 0;
|
|
27
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
28
|
+
const value_checker_1 = require("../../value_checker");
|
|
29
|
+
const luxon_1 = require("luxon");
|
|
30
|
+
const STATUS_REPORT_ORDER = [
|
|
31
|
+
messages.TestStepResultStatus.FAILED,
|
|
32
|
+
messages.TestStepResultStatus.AMBIGUOUS,
|
|
33
|
+
messages.TestStepResultStatus.UNDEFINED,
|
|
34
|
+
messages.TestStepResultStatus.PENDING,
|
|
35
|
+
messages.TestStepResultStatus.SKIPPED,
|
|
36
|
+
messages.TestStepResultStatus.PASSED,
|
|
37
|
+
];
|
|
38
|
+
function formatSummary({ colorFns, testCaseAttempts, testRunDuration, }) {
|
|
39
|
+
const testCaseResults = [];
|
|
40
|
+
const testStepResults = [];
|
|
41
|
+
let totalStepDuration = messages.TimeConversion.millisecondsToDuration(0);
|
|
42
|
+
testCaseAttempts.forEach(({ testCase, willBeRetried, worstTestStepResult, stepResults }) => {
|
|
43
|
+
Object.values(stepResults).forEach((stepResult) => {
|
|
44
|
+
totalStepDuration = messages.TimeConversion.addDurations(totalStepDuration, stepResult.duration);
|
|
45
|
+
});
|
|
46
|
+
if (!willBeRetried) {
|
|
47
|
+
testCaseResults.push(worstTestStepResult);
|
|
48
|
+
testCase.testSteps.forEach((testStep) => {
|
|
49
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
50
|
+
testStepResults.push(stepResults[testStep.id]);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const scenarioSummary = getCountSummary({
|
|
56
|
+
colorFns,
|
|
57
|
+
objects: testCaseResults,
|
|
58
|
+
type: 'scenario',
|
|
59
|
+
});
|
|
60
|
+
const stepSummary = getCountSummary({
|
|
61
|
+
colorFns,
|
|
62
|
+
objects: testStepResults,
|
|
63
|
+
type: 'step',
|
|
64
|
+
});
|
|
65
|
+
const durationSummary = `${getDurationSummary(testRunDuration)} (executing steps: ${getDurationSummary(totalStepDuration)})\n`;
|
|
66
|
+
return [scenarioSummary, stepSummary, durationSummary].join('\n');
|
|
67
|
+
}
|
|
68
|
+
exports.formatSummary = formatSummary;
|
|
69
|
+
function getCountSummary({ colorFns, objects, type, }) {
|
|
70
|
+
const counts = {};
|
|
71
|
+
STATUS_REPORT_ORDER.forEach((x) => (counts[x] = 0));
|
|
72
|
+
objects.forEach((x) => (counts[x.status] += 1));
|
|
73
|
+
const total = Object.values(counts).reduce((acc, x) => acc + x, 0);
|
|
74
|
+
let text = `${total.toString()} ${type}${total === 1 ? '' : 's'}`;
|
|
75
|
+
if (total > 0) {
|
|
76
|
+
const details = [];
|
|
77
|
+
STATUS_REPORT_ORDER.forEach((status) => {
|
|
78
|
+
if (counts[status] > 0) {
|
|
79
|
+
details.push(colorFns.forStatus(status)(`${counts[status].toString()} ${status.toLowerCase()}`));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
text += ` (${details.join(', ')})`;
|
|
83
|
+
}
|
|
84
|
+
return text;
|
|
85
|
+
}
|
|
86
|
+
function getDurationSummary(durationMsg) {
|
|
87
|
+
const start = new Date(0);
|
|
88
|
+
const end = new Date(messages.TimeConversion.durationToMilliseconds(durationMsg));
|
|
89
|
+
const duration = luxon_1.Interval.fromDateTimes(start, end).toDuration([
|
|
90
|
+
'minutes',
|
|
91
|
+
'seconds',
|
|
92
|
+
'milliseconds',
|
|
93
|
+
]);
|
|
94
|
+
return duration.toFormat("m'm'ss.SSS's'");
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=summary_helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summary_helpers.js","sourceRoot":"","sources":["../../../src/formatter/helpers/summary_helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,6DAA8C;AAC9C,uDAAmD;AACnD,iCAAgC;AAEhC,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,MA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AA8B;IACxD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAA;IACzB,MAAM,GAAG,GAAG,IAAI,IAAI,CAClB,QAAQ,CAAC,cAAc,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAC5D,CAAA;IACD,MAAM,QAAQ,GAAG,gBAAQ,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC;QAC7D,SAAS;QACT,SAAS;QACT,cAAc;KACf,CAAC,CAAA;IACF,OAAO,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import { IColorFns } from '../get_color_fns'\nimport { ITestCaseAttempt } from './event_data_collector'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\nimport { Interval } from 'luxon'\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"]}
|