@dev-blinq/cucumber-js 1.0.0-amdocs
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 +68 -0
- package/api/index.d.ts +6 -0
- package/bin/cucumber-js +3 -0
- package/bin/cucumber.js +3 -0
- package/bin/cucumber.ts +2 -0
- package/bin/download-install.js +167 -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 +66 -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 +146 -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 +177 -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 +39 -0
- package/lib/cli/helpers.js +224 -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 +64 -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 +104 -0
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/axios_client.d.ts +1 -0
- package/lib/configuration/axios_client.js +40 -0
- package/lib/configuration/axios_client.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 +29 -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 +30 -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/api.d.ts +2 -0
- package/lib/formatter/api.js +53 -0
- package/lib/formatter/api.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/bvt_analysis_formatter.d.ts +30 -0
- package/lib/formatter/bvt_analysis_formatter.js +334 -0
- package/lib/formatter/bvt_analysis_formatter.js.map +1 -0
- package/lib/formatter/feature_data_format.d.ts +23 -0
- package/lib/formatter/feature_data_format.js +182 -0
- package/lib/formatter/feature_data_format.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/constants.d.ts +44 -0
- package/lib/formatter/helpers/constants.js +50 -0
- package/lib/formatter/helpers/constants.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 +45 -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/report_generator.d.ts +148 -0
- package/lib/formatter/helpers/report_generator.js +573 -0
- package/lib/formatter/helpers/report_generator.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/upload_serivce.d.ts +26 -0
- package/lib/formatter/helpers/upload_serivce.js +237 -0
- package/lib/formatter/helpers/upload_serivce.js.map +1 -0
- package/lib/formatter/helpers/uploader.d.ts +12 -0
- package/lib/formatter/helpers/uploader.js +151 -0
- package/lib/formatter/helpers/uploader.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 +55 -0
- package/lib/runtime/test_case_runner.js +277 -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 +197 -0
|
@@ -0,0 +1,277 @@
|
|
|
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
|
+
const helpers_1 = require("./helpers");
|
|
30
|
+
const attachment_manager_1 = __importDefault(require("./attachment_manager"));
|
|
31
|
+
const step_runner_1 = __importDefault(require("./step_runner"));
|
|
32
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
33
|
+
const messages_1 = require("@cucumber/messages");
|
|
34
|
+
const value_checker_1 = require("../value_checker");
|
|
35
|
+
const report_generator_1 = __importDefault(require("../formatter/helpers/report_generator"));
|
|
36
|
+
const bvt_analysis_formatter_1 = __importDefault(require("../formatter/bvt_analysis_formatter"));
|
|
37
|
+
class TestCaseRunner {
|
|
38
|
+
constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries = 0, skip, filterStackTraces, supportCodeLibrary, worldParameters, }) {
|
|
39
|
+
this.attachmentManager = new attachment_manager_1.default(({ data, media, fileName }) => {
|
|
40
|
+
if ((0, value_checker_1.doesNotHaveValue)(this.currentTestStepId)) {
|
|
41
|
+
throw new Error('Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.');
|
|
42
|
+
}
|
|
43
|
+
const attachment = {
|
|
44
|
+
attachment: {
|
|
45
|
+
body: data,
|
|
46
|
+
contentEncoding: media.encoding,
|
|
47
|
+
mediaType: media.contentType,
|
|
48
|
+
fileName,
|
|
49
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
50
|
+
testStepId: this.currentTestStepId,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
this.eventBroadcaster.emit('envelope', attachment);
|
|
54
|
+
});
|
|
55
|
+
this.eventBroadcaster = eventBroadcaster;
|
|
56
|
+
this.stopwatch = stopwatch;
|
|
57
|
+
this.gherkinDocument = gherkinDocument;
|
|
58
|
+
this.maxAttempts = 1 + (skip ? 0 : retries);
|
|
59
|
+
this.newId = newId;
|
|
60
|
+
this.pickle = pickle;
|
|
61
|
+
this.testCase = testCase;
|
|
62
|
+
this.skip = skip;
|
|
63
|
+
this.filterStackTraces = filterStackTraces;
|
|
64
|
+
this.supportCodeLibrary = supportCodeLibrary;
|
|
65
|
+
this.worldParameters = worldParameters;
|
|
66
|
+
this.resetTestProgressData();
|
|
67
|
+
this.reportGenerator = new report_generator_1.default();
|
|
68
|
+
}
|
|
69
|
+
resetTestProgressData() {
|
|
70
|
+
this.world = new this.supportCodeLibrary.World({
|
|
71
|
+
attach: this.attachmentManager.create.bind(this.attachmentManager),
|
|
72
|
+
log: this.attachmentManager.log.bind(this.attachmentManager),
|
|
73
|
+
parameters: this.worldParameters,
|
|
74
|
+
});
|
|
75
|
+
this.testStepResults = [];
|
|
76
|
+
}
|
|
77
|
+
getBeforeStepHookDefinitions() {
|
|
78
|
+
return this.supportCodeLibrary.beforeTestStepHookDefinitions.filter((hookDefinition) => hookDefinition.appliesToTestCase(this.pickle));
|
|
79
|
+
}
|
|
80
|
+
getAfterStepHookDefinitions() {
|
|
81
|
+
return this.supportCodeLibrary.afterTestStepHookDefinitions
|
|
82
|
+
.slice(0)
|
|
83
|
+
.reverse()
|
|
84
|
+
.filter((hookDefinition) => hookDefinition.appliesToTestCase(this.pickle));
|
|
85
|
+
}
|
|
86
|
+
getWorstStepResult() {
|
|
87
|
+
if (this.testStepResults.length === 0) {
|
|
88
|
+
return {
|
|
89
|
+
status: this.skip
|
|
90
|
+
? messages.TestStepResultStatus.SKIPPED
|
|
91
|
+
: messages.TestStepResultStatus.PASSED,
|
|
92
|
+
duration: messages.TimeConversion.millisecondsToDuration(0),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return (0, messages_1.getWorstTestStepResult)(this.testStepResults);
|
|
96
|
+
}
|
|
97
|
+
async invokeStep(step, stepDefinition, hookParameter) {
|
|
98
|
+
return await step_runner_1.default.run({
|
|
99
|
+
defaultTimeout: this.supportCodeLibrary.defaultTimeout,
|
|
100
|
+
filterStackTraces: this.filterStackTraces,
|
|
101
|
+
hookParameter,
|
|
102
|
+
step,
|
|
103
|
+
stepDefinition,
|
|
104
|
+
world: this.world,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
isSkippingSteps() {
|
|
108
|
+
return (this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED);
|
|
109
|
+
}
|
|
110
|
+
shouldSkipHook(isBeforeHook) {
|
|
111
|
+
return this.skip || (this.isSkippingSteps() && isBeforeHook);
|
|
112
|
+
}
|
|
113
|
+
async aroundTestStep(testStepId, runStepFn) {
|
|
114
|
+
const testStepStarted = {
|
|
115
|
+
testStepStarted: {
|
|
116
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
117
|
+
testStepId,
|
|
118
|
+
timestamp: this.stopwatch.timestamp(),
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
this.eventBroadcaster.emit('envelope', testStepStarted);
|
|
122
|
+
this.currentTestStepId = testStepId;
|
|
123
|
+
const testStepResult = await runStepFn();
|
|
124
|
+
this.currentTestStepId = null;
|
|
125
|
+
this.testStepResults.push(testStepResult);
|
|
126
|
+
const testStepFinished = {
|
|
127
|
+
testStepFinished: {
|
|
128
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
129
|
+
testStepId,
|
|
130
|
+
testStepResult,
|
|
131
|
+
timestamp: this.stopwatch.timestamp(),
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
this.eventBroadcaster.emit('envelope', testStepFinished);
|
|
135
|
+
}
|
|
136
|
+
async run() {
|
|
137
|
+
for (let attempt = 0; attempt < this.maxAttempts; attempt++) {
|
|
138
|
+
const moreAttemptsRemaining = attempt + 1 < this.maxAttempts;
|
|
139
|
+
const willBeRetried = await this.runAttempt(attempt, moreAttemptsRemaining);
|
|
140
|
+
if (!willBeRetried) {
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
this.resetTestProgressData();
|
|
144
|
+
}
|
|
145
|
+
return this.getWorstStepResult().status;
|
|
146
|
+
}
|
|
147
|
+
async runAttempt(attempt, moreAttemptsRemaining) {
|
|
148
|
+
this.currentTestCaseStartedId = this.newId();
|
|
149
|
+
const testCaseStarted = {
|
|
150
|
+
testCaseStarted: {
|
|
151
|
+
attempt,
|
|
152
|
+
testCaseId: this.testCase.id,
|
|
153
|
+
id: this.currentTestCaseStartedId,
|
|
154
|
+
timestamp: this.stopwatch.timestamp(),
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
this.eventBroadcaster.emit('envelope', testCaseStarted);
|
|
158
|
+
// used to determine whether a hook is a Before or After
|
|
159
|
+
let didWeRunStepsYet = false;
|
|
160
|
+
for (const testStep of this.testCase.testSteps) {
|
|
161
|
+
await this.aroundTestStep(testStep.id, async () => {
|
|
162
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.hookId)) {
|
|
163
|
+
const hookParameter = {
|
|
164
|
+
gherkinDocument: this.gherkinDocument,
|
|
165
|
+
pickle: this.pickle,
|
|
166
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
167
|
+
};
|
|
168
|
+
if (didWeRunStepsYet) {
|
|
169
|
+
hookParameter.result = this.getWorstStepResult();
|
|
170
|
+
hookParameter.willBeRetried =
|
|
171
|
+
this.getWorstStepResult().status ===
|
|
172
|
+
messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;
|
|
173
|
+
}
|
|
174
|
+
return await this.runHook(findHookDefinition(testStep.hookId, this.supportCodeLibrary), hookParameter, !didWeRunStepsYet);
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
const pickleStep = this.pickle.steps.find((pickleStep) => pickleStep.id === testStep.pickleStepId);
|
|
178
|
+
const testStepResult = await this.runStep(pickleStep, testStep);
|
|
179
|
+
didWeRunStepsYet = true;
|
|
180
|
+
return testStepResult;
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
const willBeRetried = this.getWorstStepResult().status ===
|
|
185
|
+
messages.TestStepResultStatus.FAILED && moreAttemptsRemaining;
|
|
186
|
+
const testCaseFinished = {
|
|
187
|
+
testCaseFinished: {
|
|
188
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
189
|
+
timestamp: this.stopwatch.timestamp(),
|
|
190
|
+
willBeRetried,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
const rerunId = bvt_analysis_formatter_1.default.reRunFailedStepsIndex
|
|
194
|
+
? bvt_analysis_formatter_1.default.reRunFailedStepsIndex[0].testCaseId
|
|
195
|
+
: null;
|
|
196
|
+
const data = bvt_analysis_formatter_1.default.reportGenerator
|
|
197
|
+
? await bvt_analysis_formatter_1.default.reportGenerator.handleMessage(testCaseFinished, rerunId)
|
|
198
|
+
: null;
|
|
199
|
+
this.eventBroadcaster.emit('envelope', testCaseFinished, data);
|
|
200
|
+
return willBeRetried;
|
|
201
|
+
}
|
|
202
|
+
async runHook(hookDefinition, hookParameter, isBeforeHook) {
|
|
203
|
+
if (this.shouldSkipHook(isBeforeHook)) {
|
|
204
|
+
return {
|
|
205
|
+
status: messages.TestStepResultStatus.SKIPPED,
|
|
206
|
+
duration: messages.TimeConversion.millisecondsToDuration(0),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return await this.invokeStep(null, hookDefinition, hookParameter);
|
|
210
|
+
}
|
|
211
|
+
async runStepHooks(stepHooks, pickleStep, stepResult) {
|
|
212
|
+
const stepHooksResult = [];
|
|
213
|
+
const hookParameter = {
|
|
214
|
+
gherkinDocument: this.gherkinDocument,
|
|
215
|
+
pickle: this.pickle,
|
|
216
|
+
pickleStep,
|
|
217
|
+
testCaseStartedId: this.currentTestCaseStartedId,
|
|
218
|
+
testStepId: this.currentTestStepId,
|
|
219
|
+
result: stepResult,
|
|
220
|
+
};
|
|
221
|
+
for (const stepHookDefinition of stepHooks) {
|
|
222
|
+
stepHooksResult.push(await this.invokeStep(null, stepHookDefinition, hookParameter));
|
|
223
|
+
}
|
|
224
|
+
return stepHooksResult;
|
|
225
|
+
}
|
|
226
|
+
async runStep(pickleStep, testStep) {
|
|
227
|
+
const stepDefinitions = testStep.stepDefinitionIds.map((stepDefinitionId) => {
|
|
228
|
+
return findStepDefinition(stepDefinitionId, this.supportCodeLibrary);
|
|
229
|
+
});
|
|
230
|
+
if (stepDefinitions.length === 0) {
|
|
231
|
+
return {
|
|
232
|
+
status: messages.TestStepResultStatus.UNDEFINED,
|
|
233
|
+
duration: messages.TimeConversion.millisecondsToDuration(0),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
else if (stepDefinitions.length > 1) {
|
|
237
|
+
return {
|
|
238
|
+
message: (0, helpers_1.getAmbiguousStepException)(stepDefinitions),
|
|
239
|
+
status: messages.TestStepResultStatus.AMBIGUOUS,
|
|
240
|
+
duration: messages.TimeConversion.millisecondsToDuration(0),
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
else if (this.isSkippingSteps()) {
|
|
244
|
+
return {
|
|
245
|
+
status: messages.TestStepResultStatus.SKIPPED,
|
|
246
|
+
duration: messages.TimeConversion.millisecondsToDuration(0),
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
let stepResult;
|
|
250
|
+
let stepResults = await this.runStepHooks(this.getBeforeStepHookDefinitions(), pickleStep);
|
|
251
|
+
if ((0, messages_1.getWorstTestStepResult)(stepResults).status !==
|
|
252
|
+
messages.TestStepResultStatus.FAILED) {
|
|
253
|
+
stepResult = await this.invokeStep(pickleStep, stepDefinitions[0]);
|
|
254
|
+
stepResults.push(stepResult);
|
|
255
|
+
}
|
|
256
|
+
const afterStepHookResults = await this.runStepHooks(this.getAfterStepHookDefinitions(), pickleStep, stepResult);
|
|
257
|
+
stepResults = stepResults.concat(afterStepHookResults);
|
|
258
|
+
const finalStepResult = (0, messages_1.getWorstTestStepResult)(stepResults);
|
|
259
|
+
let finalDuration = messages.TimeConversion.millisecondsToDuration(0);
|
|
260
|
+
for (const result of stepResults) {
|
|
261
|
+
finalDuration = messages.TimeConversion.addDurations(finalDuration, result.duration);
|
|
262
|
+
}
|
|
263
|
+
finalStepResult.duration = finalDuration;
|
|
264
|
+
return finalStepResult;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
exports.default = TestCaseRunner;
|
|
268
|
+
function findHookDefinition(id, supportCodeLibrary) {
|
|
269
|
+
return [
|
|
270
|
+
...supportCodeLibrary.beforeTestCaseHookDefinitions,
|
|
271
|
+
...supportCodeLibrary.afterTestCaseHookDefinitions,
|
|
272
|
+
].find((definition) => definition.id === id);
|
|
273
|
+
}
|
|
274
|
+
function findStepDefinition(id, supportCodeLibrary) {
|
|
275
|
+
return supportCodeLibrary.stepDefinitions.find((definition) => definition.id === id);
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=test_case_runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test_case_runner.js","sourceRoot":"","sources":["../../src/runtime/test_case_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAqD;AACrD,8EAAoD;AACpD,gEAAsC;AACtC,6DAA8C;AAC9C,iDAAwE;AAUxE,oDAAkE;AAGlE,6FAAmE;AACnE,iGAAsE;AAgBtE,MAAqB,cAAc;IAmBjC,YAAY,EACV,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,IAAI,EACJ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,GACW;QAC1B,IAAI,CAAC,iBAAiB,GAAG,IAAI,4BAAiB,CAC5C,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE;YAC5B,IAAI,IAAA,gCAAgB,EAAC,IAAI,CAAC,iBAAiB,CAAC,EAAE;gBAC5C,MAAM,IAAI,KAAK,CACb,sGAAsG,CACvG,CAAA;aACF;YACD,MAAM,UAAU,GAAsB;gBACpC,UAAU,EAAE;oBACV,IAAI,EAAE,IAAI;oBACV,eAAe,EAAE,KAAK,CAAC,QAAQ;oBAC/B,SAAS,EAAE,KAAK,CAAC,WAAW;oBAC5B,QAAQ;oBACR,iBAAiB,EAAE,IAAI,CAAC,wBAAwB;oBAChD,UAAU,EAAE,IAAI,CAAC,iBAAiB;iBACnC;aACF,CAAA;YACD,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;QACpD,CAAC,CACF,CAA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AAhVD,iCAgVC;AAED,SAAS,kBAAkB,CACzB,EAAU,EACV,kBAAuC;IAEvC,OAAO;QACL,GAAG,kBAAkB,CAAC,6BAA6B;QACnD,GAAG,kBAAkB,CAAC,4BAA4B;KACnD,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AAC9C,CAAC;AAED,SAAS,kBAAkB,CACzB,EAAU,EACV,kBAAuC;IAEvC,OAAO,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAC5C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CACrC,CAAA;AACH,CAAC","sourcesContent":["import { getAmbiguousStepException } from './helpers'\nimport AttachmentManager from './attachment_manager'\nimport StepRunner from './step_runner'\nimport * as messages from '@cucumber/messages'\nimport { getWorstTestStepResult, IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport {\n ISupportCodeLibrary,\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from '../support_code_library_builder/types'\nimport TestCaseHookDefinition from '../models/test_case_hook_definition'\nimport TestStepHookDefinition from '../models/test_step_hook_definition'\nimport { IDefinition } from '../models/definition'\nimport { doesHaveValue, doesNotHaveValue } from '../value_checker'\nimport { IStopwatch } from './stopwatch'\nimport StepDefinition from '../models/step_definition'\nimport ReportGenerator from '../formatter/helpers/report_generator'\nimport BVTAnalysisFormatter from '../formatter/bvt_analysis_formatter'\n\nexport interface INewTestCaseRunnerOptions {\n eventBroadcaster: EventEmitter\n stopwatch: IStopwatch\n gherkinDocument: messages.GherkinDocument\n newId: IdGenerator.NewId\n pickle: messages.Pickle\n testCase: messages.TestCase\n retries: number\n skip: boolean\n filterStackTraces: boolean\n supportCodeLibrary: ISupportCodeLibrary\n worldParameters: any\n}\n\nexport default class TestCaseRunner {\n private readonly attachmentManager: AttachmentManager\n private currentTestCaseStartedId: string\n private currentTestStepId: string\n private readonly eventBroadcaster: EventEmitter\n private readonly stopwatch: IStopwatch\n private readonly gherkinDocument: messages.GherkinDocument\n private readonly newId: IdGenerator.NewId\n private readonly pickle: messages.Pickle\n private readonly testCase: messages.TestCase\n private readonly maxAttempts: number\n private readonly skip: boolean\n private readonly filterStackTraces: boolean\n private readonly supportCodeLibrary: ISupportCodeLibrary\n private testStepResults: messages.TestStepResult[]\n private world: any\n private readonly worldParameters: any\n private reportGenerator: ReportGenerator\n\n constructor({\n eventBroadcaster,\n stopwatch,\n gherkinDocument,\n newId,\n pickle,\n testCase,\n retries = 0,\n skip,\n filterStackTraces,\n supportCodeLibrary,\n worldParameters,\n }: INewTestCaseRunnerOptions) {\n this.attachmentManager = new AttachmentManager(\n ({ data, media, fileName }) => {\n if (doesNotHaveValue(this.currentTestStepId)) {\n throw new Error(\n 'Cannot attach when a step/hook is not running. Ensure your step/hook waits for the attach to finish.'\n )\n }\n const attachment: messages.Envelope = {\n attachment: {\n body: data,\n contentEncoding: media.encoding,\n mediaType: media.contentType,\n fileName,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n },\n }\n this.eventBroadcaster.emit('envelope', attachment)\n }\n )\n this.eventBroadcaster = eventBroadcaster\n this.stopwatch = stopwatch\n this.gherkinDocument = gherkinDocument\n this.maxAttempts = 1 + (skip ? 0 : retries)\n this.newId = newId\n this.pickle = pickle\n this.testCase = testCase\n this.skip = skip\n this.filterStackTraces = filterStackTraces\n this.supportCodeLibrary = supportCodeLibrary\n this.worldParameters = worldParameters\n this.resetTestProgressData()\n this.reportGenerator = new ReportGenerator()\n }\n\n resetTestProgressData(): void {\n this.world = new this.supportCodeLibrary.World({\n attach: this.attachmentManager.create.bind(this.attachmentManager),\n log: this.attachmentManager.log.bind(this.attachmentManager),\n parameters: this.worldParameters,\n })\n this.testStepResults = []\n }\n\n getBeforeStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.beforeTestStepHookDefinitions.filter(\n (hookDefinition) => hookDefinition.appliesToTestCase(this.pickle)\n )\n }\n\n getAfterStepHookDefinitions(): TestStepHookDefinition[] {\n return this.supportCodeLibrary.afterTestStepHookDefinitions\n .slice(0)\n .reverse()\n .filter((hookDefinition) => hookDefinition.appliesToTestCase(this.pickle))\n }\n\n getWorstStepResult(): messages.TestStepResult {\n if (this.testStepResults.length === 0) {\n return {\n status: this.skip\n ? messages.TestStepResultStatus.SKIPPED\n : messages.TestStepResultStatus.PASSED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n return getWorstTestStepResult(this.testStepResults)\n }\n\n async invokeStep(\n step: messages.PickleStep,\n stepDefinition: IDefinition,\n hookParameter?: any\n ): Promise<messages.TestStepResult> {\n return await StepRunner.run({\n defaultTimeout: this.supportCodeLibrary.defaultTimeout,\n filterStackTraces: this.filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world: this.world,\n })\n }\n\n isSkippingSteps(): boolean {\n return (\n this.getWorstStepResult().status !== messages.TestStepResultStatus.PASSED\n )\n }\n\n shouldSkipHook(isBeforeHook: boolean): boolean {\n return this.skip || (this.isSkippingSteps() && isBeforeHook)\n }\n\n async aroundTestStep(\n testStepId: string,\n runStepFn: () => Promise<messages.TestStepResult>\n ): Promise<void> {\n const testStepStarted: messages.Envelope = {\n testStepStarted: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepStarted)\n this.currentTestStepId = testStepId\n const testStepResult = await runStepFn()\n this.currentTestStepId = null\n this.testStepResults.push(testStepResult)\n const testStepFinished: messages.Envelope = {\n testStepFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId,\n testStepResult,\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testStepFinished)\n }\n\n async run(): Promise<messages.TestStepResultStatus> {\n for (let attempt = 0; attempt < this.maxAttempts; attempt++) {\n const moreAttemptsRemaining = attempt + 1 < this.maxAttempts\n\n const willBeRetried = await this.runAttempt(\n attempt,\n moreAttemptsRemaining\n )\n\n if (!willBeRetried) {\n break\n }\n this.resetTestProgressData()\n }\n return this.getWorstStepResult().status\n }\n\n async runAttempt(\n attempt: number,\n moreAttemptsRemaining: boolean\n ): Promise<boolean> {\n this.currentTestCaseStartedId = this.newId()\n const testCaseStarted: messages.Envelope = {\n testCaseStarted: {\n attempt,\n testCaseId: this.testCase.id,\n id: this.currentTestCaseStartedId,\n timestamp: this.stopwatch.timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', testCaseStarted)\n // used to determine whether a hook is a Before or After\n let didWeRunStepsYet = false\n for (const testStep of this.testCase.testSteps) {\n await this.aroundTestStep(testStep.id, async () => {\n if (doesHaveValue(testStep.hookId)) {\n const hookParameter: ITestCaseHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n testCaseStartedId: this.currentTestCaseStartedId,\n }\n if (didWeRunStepsYet) {\n hookParameter.result = this.getWorstStepResult()\n hookParameter.willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n }\n return await this.runHook(\n findHookDefinition(testStep.hookId, this.supportCodeLibrary),\n hookParameter,\n !didWeRunStepsYet\n )\n } else {\n const pickleStep = this.pickle.steps.find(\n (pickleStep) => pickleStep.id === testStep.pickleStepId\n )\n const testStepResult = await this.runStep(pickleStep, testStep)\n didWeRunStepsYet = true\n return testStepResult\n }\n })\n }\n\n const willBeRetried =\n this.getWorstStepResult().status ===\n messages.TestStepResultStatus.FAILED && moreAttemptsRemaining\n const testCaseFinished: messages.Envelope = {\n testCaseFinished: {\n testCaseStartedId: this.currentTestCaseStartedId,\n timestamp: this.stopwatch.timestamp(),\n willBeRetried,\n },\n }\n\n const rerunId = BVTAnalysisFormatter.reRunFailedStepsIndex\n ? BVTAnalysisFormatter.reRunFailedStepsIndex[0].testCaseId\n : null\n\n const data = BVTAnalysisFormatter.reportGenerator\n ? await BVTAnalysisFormatter.reportGenerator.handleMessage(\n testCaseFinished,\n rerunId\n )\n : null\n\n this.eventBroadcaster.emit('envelope', testCaseFinished, data)\n\n return willBeRetried\n }\n\n async runHook(\n hookDefinition: TestCaseHookDefinition,\n hookParameter: ITestCaseHookParameter,\n isBeforeHook: boolean\n ): Promise<messages.TestStepResult> {\n if (this.shouldSkipHook(isBeforeHook)) {\n return {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n return await this.invokeStep(null, hookDefinition, hookParameter)\n }\n\n async runStepHooks(\n stepHooks: TestStepHookDefinition[],\n pickleStep: messages.PickleStep,\n stepResult?: messages.TestStepResult\n ): Promise<messages.TestStepResult[]> {\n const stepHooksResult = []\n const hookParameter: ITestStepHookParameter = {\n gherkinDocument: this.gherkinDocument,\n pickle: this.pickle,\n pickleStep,\n testCaseStartedId: this.currentTestCaseStartedId,\n testStepId: this.currentTestStepId,\n result: stepResult,\n }\n for (const stepHookDefinition of stepHooks) {\n stepHooksResult.push(\n await this.invokeStep(null, stepHookDefinition, hookParameter)\n )\n }\n return stepHooksResult\n }\n\n async runStep(\n pickleStep: messages.PickleStep,\n testStep: messages.TestStep\n ): Promise<messages.TestStepResult> {\n const stepDefinitions = testStep.stepDefinitionIds.map(\n (stepDefinitionId) => {\n return findStepDefinition(stepDefinitionId, this.supportCodeLibrary)\n }\n )\n if (stepDefinitions.length === 0) {\n return {\n status: messages.TestStepResultStatus.UNDEFINED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n } else if (stepDefinitions.length > 1) {\n return {\n message: getAmbiguousStepException(stepDefinitions),\n status: messages.TestStepResultStatus.AMBIGUOUS,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n } else if (this.isSkippingSteps()) {\n return {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n }\n }\n\n let stepResult\n let stepResults = await this.runStepHooks(\n this.getBeforeStepHookDefinitions(),\n pickleStep\n )\n if (\n getWorstTestStepResult(stepResults).status !==\n messages.TestStepResultStatus.FAILED\n ) {\n stepResult = await this.invokeStep(pickleStep, stepDefinitions[0])\n stepResults.push(stepResult)\n }\n const afterStepHookResults = await this.runStepHooks(\n this.getAfterStepHookDefinitions(),\n pickleStep,\n stepResult\n )\n stepResults = stepResults.concat(afterStepHookResults)\n\n const finalStepResult = getWorstTestStepResult(stepResults)\n let finalDuration = messages.TimeConversion.millisecondsToDuration(0)\n for (const result of stepResults) {\n finalDuration = messages.TimeConversion.addDurations(\n finalDuration,\n result.duration\n )\n }\n finalStepResult.duration = finalDuration\n return finalStepResult\n }\n}\n\nfunction findHookDefinition(\n id: string,\n supportCodeLibrary: ISupportCodeLibrary\n): TestCaseHookDefinition {\n return [\n ...supportCodeLibrary.beforeTestCaseHookDefinitions,\n ...supportCodeLibrary.afterTestCaseHookDefinitions,\n ].find((definition) => definition.id === id)\n}\n\nfunction findStepDefinition(\n id: string,\n supportCodeLibrary: ISupportCodeLibrary\n): StepDefinition {\n return supportCodeLibrary.stepDefinitions.find(\n (definition) => definition.id === id\n )\n}\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
export interface IPickleStepArgumentFunctionMap<T> {
|
|
3
|
+
dataTable: (arg: messages.PickleTable) => T;
|
|
4
|
+
docString: (arg: messages.PickleDocString) => T;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseStepArgument<T>(arg: messages.PickleStepArgument, mapping: IPickleStepArgumentFunctionMap<T>): T;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseStepArgument = void 0;
|
|
7
|
+
const util_1 = __importDefault(require("util"));
|
|
8
|
+
const value_checker_1 = require("./value_checker");
|
|
9
|
+
function parseStepArgument(arg, mapping) {
|
|
10
|
+
if ((0, value_checker_1.doesHaveValue)(arg.dataTable)) {
|
|
11
|
+
return mapping.dataTable(arg.dataTable);
|
|
12
|
+
}
|
|
13
|
+
else if ((0, value_checker_1.doesHaveValue)(arg.docString)) {
|
|
14
|
+
return mapping.docString(arg.docString);
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`Unknown step argument: ${util_1.default.inspect(arg)}`);
|
|
17
|
+
}
|
|
18
|
+
exports.parseStepArgument = parseStepArgument;
|
|
19
|
+
//# sourceMappingURL=step_arguments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step_arguments.js","sourceRoot":"","sources":["../src/step_arguments.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AAEvB,mDAA+C;AAO/C,SAAgB,iBAAiB,CAC/B,GAAgC,EAChC,OAA0C;IAE1C,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAChC,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;KACxC;SAAM,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QACvC,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;KACxC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,cAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC;AAVD,8CAUC","sourcesContent":["import util from 'util'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from './value_checker'\n\nexport interface IPickleStepArgumentFunctionMap<T> {\n dataTable: (arg: messages.PickleTable) => T\n docString: (arg: messages.PickleDocString) => T\n}\n\nexport function parseStepArgument<T>(\n arg: messages.PickleStepArgument,\n mapping: IPickleStepArgumentFunctionMap<T>\n): T {\n if (doesHaveValue(arg.dataTable)) {\n return mapping.dataTable(arg.dataTable)\n } else if (doesHaveValue(arg.docString)) {\n return mapping.docString(arg.docString)\n }\n throw new Error(`Unknown step argument: ${util.inspect(arg)}`)\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParameterType } from '@cucumber/cucumber-expressions';
|
|
2
|
+
import { IParameterTypeDefinition } from './types';
|
|
3
|
+
export declare function buildParameterType({ name, regexp, transformer, useForSnippets, preferForRegexpMatch, }: IParameterTypeDefinition<any>): ParameterType<any>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildParameterType = void 0;
|
|
4
|
+
const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
|
|
5
|
+
function buildParameterType({ name, regexp, transformer, useForSnippets, preferForRegexpMatch, }) {
|
|
6
|
+
if (typeof useForSnippets !== 'boolean')
|
|
7
|
+
useForSnippets = true;
|
|
8
|
+
if (typeof preferForRegexpMatch !== 'boolean')
|
|
9
|
+
preferForRegexpMatch = false;
|
|
10
|
+
return new cucumber_expressions_1.ParameterType(name, regexp, null, transformer, useForSnippets, preferForRegexpMatch);
|
|
11
|
+
}
|
|
12
|
+
exports.buildParameterType = buildParameterType;
|
|
13
|
+
//# sourceMappingURL=build_parameter_type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build_parameter_type.js","sourceRoot":"","sources":["../../src/support_code_library_builder/build_parameter_type.ts"],"names":[],"mappings":";;;AAAA,yEAA8D;AAG9D,SAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,WAAW,EACX,cAAc,EACd,oBAAoB,GACU;IAC9B,IAAI,OAAO,cAAc,KAAK,SAAS;QAAE,cAAc,GAAG,IAAI,CAAA;IAC9D,IAAI,OAAO,oBAAoB,KAAK,SAAS;QAAE,oBAAoB,GAAG,KAAK,CAAA;IAC3E,OAAO,IAAI,oCAAa,CACtB,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,WAAW,EACX,cAAc,EACd,oBAAoB,CACrB,CAAA;AACH,CAAC;AAjBD,gDAiBC","sourcesContent":["import { ParameterType } from '@cucumber/cucumber-expressions'\nimport { IParameterTypeDefinition } from './types'\n\nexport function buildParameterType({\n name,\n regexp,\n transformer,\n useForSnippets,\n preferForRegexpMatch,\n}: IParameterTypeDefinition<any>): ParameterType<any> {\n if (typeof useForSnippets !== 'boolean') useForSnippets = true\n if (typeof preferForRegexpMatch !== 'boolean') preferForRegexpMatch = false\n return new ParameterType(\n name,\n regexp,\n null,\n transformer,\n useForSnippets,\n preferForRegexpMatch\n )\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
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.getDefinitionLineAndUri = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const error_stack_parser_1 = __importDefault(require("error-stack-parser"));
|
|
9
|
+
const filter_stack_trace_1 = require("../filter_stack_trace");
|
|
10
|
+
const value_checker_1 = require("../value_checker");
|
|
11
|
+
function getDefinitionLineAndUri(cwd, isExcluded = filter_stack_trace_1.isFileNameInCucumber) {
|
|
12
|
+
let line;
|
|
13
|
+
let uri;
|
|
14
|
+
const stackframes = error_stack_parser_1.default.parse(new Error());
|
|
15
|
+
const stackframe = stackframes.find((frame) => frame.fileName !== __filename && !isExcluded(frame.fileName));
|
|
16
|
+
if (stackframe != null) {
|
|
17
|
+
line = stackframe.getLineNumber();
|
|
18
|
+
uri = stackframe.getFileName();
|
|
19
|
+
if ((0, value_checker_1.doesHaveValue)(uri)) {
|
|
20
|
+
uri = path_1.default.relative(cwd, uri);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
line: (0, value_checker_1.valueOrDefault)(line, 0),
|
|
25
|
+
uri: (0, value_checker_1.valueOrDefault)(uri, 'unknown'),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.getDefinitionLineAndUri = getDefinitionLineAndUri;
|
|
29
|
+
//# sourceMappingURL=get_definition_line_and_uri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get_definition_line_and_uri.js","sourceRoot":"","sources":["../../src/support_code_library_builder/get_definition_line_and_uri.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAuB;AACvB,4EAAiE;AACjE,8DAA4D;AAC5D,oDAAgE;AAGhE,SAAgB,uBAAuB,CACrC,GAAW,EACX,UAAU,GAAG,yCAAoB;IAEjC,IAAI,IAAY,CAAA;IAChB,IAAI,GAAW,CAAA;IACf,MAAM,WAAW,GAAiB,4BAAgB,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,WAAW,CAAC,IAAI,CACjC,CAAC,KAAiB,EAAE,EAAE,CACpB,KAAK,CAAC,QAAQ,KAAK,UAAU,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAC/D,CAAA;IACD,IAAI,UAAU,IAAI,IAAI,EAAE;QACtB,IAAI,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;QACjC,GAAG,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;QAC9B,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE;YACtB,GAAG,GAAG,cAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;SAC9B;KACF;IAED,OAAO;QACL,IAAI,EAAE,IAAA,8BAAc,EAAC,IAAI,EAAE,CAAC,CAAC;QAC7B,GAAG,EAAE,IAAA,8BAAc,EAAC,GAAG,EAAE,SAAS,CAAC;KACpC,CAAA;AACH,CAAC;AAvBD,0DAuBC","sourcesContent":["import path from 'path'\nimport errorStackParser, { StackFrame } from 'error-stack-parser'\nimport { isFileNameInCucumber } from '../filter_stack_trace'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { ILineAndUri } from '../types'\n\nexport function getDefinitionLineAndUri(\n cwd: string,\n isExcluded = isFileNameInCucumber\n): ILineAndUri {\n let line: number\n let uri: string\n const stackframes: StackFrame[] = errorStackParser.parse(new Error())\n const stackframe = stackframes.find(\n (frame: StackFrame) =>\n frame.fileName !== __filename && !isExcluded(frame.fileName)\n )\n if (stackframe != null) {\n line = stackframe.getLineNumber()\n uri = stackframe.getFileName()\n if (doesHaveValue(uri)) {\n uri = path.relative(cwd, uri)\n }\n }\n\n return {\n line: valueOrDefault(line, 0),\n uri: valueOrDefault(uri, 'unknown'),\n }\n}\n"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
2
|
+
import * as messages from '@cucumber/messages';
|
|
3
|
+
import TestCaseHookDefinition from '../models/test_case_hook_definition';
|
|
4
|
+
import TestStepHookDefinition from '../models/test_step_hook_definition';
|
|
5
|
+
import TestRunHookDefinition from '../models/test_run_hook_definition';
|
|
6
|
+
import StepDefinition from '../models/step_definition';
|
|
7
|
+
import { IDefineSupportCodeMethods, IDefineTestCaseHookOptions, IDefineTestStepHookOptions, IDefineTestRunHookOptions, IParameterTypeDefinition, ISupportCodeLibrary, TestCaseHookFunction, TestStepHookFunction, ISupportCodeCoordinates, IDefineStep } from './types';
|
|
8
|
+
import { ICanonicalSupportCodeIds } from '../runtime/parallel/command_types';
|
|
9
|
+
import { GherkinStepKeyword } from '../models/gherkin_step_keyword';
|
|
10
|
+
interface IStepDefinitionConfig {
|
|
11
|
+
code: any;
|
|
12
|
+
line: number;
|
|
13
|
+
options: any;
|
|
14
|
+
keyword: GherkinStepKeyword;
|
|
15
|
+
pattern: string | RegExp;
|
|
16
|
+
uri: string;
|
|
17
|
+
}
|
|
18
|
+
interface ITestCaseHookDefinitionConfig {
|
|
19
|
+
code: any;
|
|
20
|
+
line: number;
|
|
21
|
+
options: any;
|
|
22
|
+
uri: string;
|
|
23
|
+
}
|
|
24
|
+
interface ITestStepHookDefinitionConfig {
|
|
25
|
+
code: any;
|
|
26
|
+
line: number;
|
|
27
|
+
options: any;
|
|
28
|
+
uri: string;
|
|
29
|
+
}
|
|
30
|
+
interface ITestRunHookDefinitionConfig {
|
|
31
|
+
code: any;
|
|
32
|
+
line: number;
|
|
33
|
+
options: any;
|
|
34
|
+
uri: string;
|
|
35
|
+
}
|
|
36
|
+
export declare class SupportCodeLibraryBuilder {
|
|
37
|
+
readonly methods: IDefineSupportCodeMethods;
|
|
38
|
+
private originalCoordinates;
|
|
39
|
+
private afterTestCaseHookDefinitionConfigs;
|
|
40
|
+
private afterTestRunHookDefinitionConfigs;
|
|
41
|
+
private afterTestStepHookDefinitionConfigs;
|
|
42
|
+
private beforeTestCaseHookDefinitionConfigs;
|
|
43
|
+
private beforeTestRunHookDefinitionConfigs;
|
|
44
|
+
private beforeTestStepHookDefinitionConfigs;
|
|
45
|
+
private cwd;
|
|
46
|
+
private defaultTimeout;
|
|
47
|
+
private definitionFunctionWrapper;
|
|
48
|
+
private newId;
|
|
49
|
+
private parameterTypeRegistry;
|
|
50
|
+
private stepDefinitionConfigs;
|
|
51
|
+
private World;
|
|
52
|
+
private parallelCanAssign;
|
|
53
|
+
constructor();
|
|
54
|
+
defineParameterType(options: IParameterTypeDefinition<any>): void;
|
|
55
|
+
defineStep(keyword: GherkinStepKeyword, getCollection: () => IStepDefinitionConfig[]): IDefineStep;
|
|
56
|
+
defineTestCaseHook(getCollection: () => ITestCaseHookDefinitionConfig[]): <WorldType>(options: string | IDefineTestCaseHookOptions | TestCaseHookFunction<WorldType>, code?: TestCaseHookFunction<WorldType>) => void;
|
|
57
|
+
defineTestStepHook(getCollection: () => ITestStepHookDefinitionConfig[]): <WorldType>(options: string | IDefineTestStepHookOptions | TestStepHookFunction<WorldType>, code?: TestStepHookFunction<WorldType>) => void;
|
|
58
|
+
defineTestRunHook(getCollection: () => ITestRunHookDefinitionConfig[]): (options: IDefineTestRunHookOptions | Function, code?: Function) => void;
|
|
59
|
+
wrapCode({ code, wrapperOptions, }: {
|
|
60
|
+
code: Function;
|
|
61
|
+
wrapperOptions: any;
|
|
62
|
+
}): Function;
|
|
63
|
+
buildTestCaseHookDefinitions(configs: ITestCaseHookDefinitionConfig[], canonicalIds?: string[]): TestCaseHookDefinition[];
|
|
64
|
+
buildTestStepHookDefinitions(configs: ITestStepHookDefinitionConfig[]): TestStepHookDefinition[];
|
|
65
|
+
buildTestRunHookDefinitions(configs: ITestRunHookDefinitionConfig[]): TestRunHookDefinition[];
|
|
66
|
+
buildStepDefinitions(canonicalIds?: string[]): {
|
|
67
|
+
stepDefinitions: StepDefinition[];
|
|
68
|
+
undefinedParameterTypes: messages.UndefinedParameterType[];
|
|
69
|
+
};
|
|
70
|
+
finalize(canonicalIds?: ICanonicalSupportCodeIds): ISupportCodeLibrary;
|
|
71
|
+
reset(cwd: string, newId: IdGenerator.NewId, originalCoordinates?: ISupportCodeCoordinates): void;
|
|
72
|
+
}
|
|
73
|
+
declare const _default: SupportCodeLibraryBuilder;
|
|
74
|
+
export default _default;
|