@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 @@
|
|
|
1
|
+
{"version":3,"file":"run_worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/run_worker.ts"],"names":[],"mappings":";;;;;AAAA,sDAA6B;AAC7B,oDAA2B;AAC3B,uDAAmD;AAEnD,SAAS,GAAG;IACV,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,OAAgB,EAAQ,EAAE;QACvE,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;YACxB,OAAO,CAAC,KAAK,CAAC,gBAAM,CAAC,SAAS,CAAC,IAAI,gBAAM,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAA,CAAC,iCAAiC;SAC9F;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACxB,CAAC,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC;QACxB,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB;QAClC,WAAW,EAAE,CAAC,OAAY,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;QACpD,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,IAAI;KACL,CAAC,CAAA;IACF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAM,EAAQ,EAAE;QACrC,MAAM;aACH,cAAc,CAAC,CAAC,CAAC;aACjB,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE,CACtB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,2CAA2C,CAAC,CAC5D,CAAA;IACL,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,GAAG,EAAE,CAAA","sourcesContent":["import Worker from './worker'\nimport VError from 'verror'\nimport { doesHaveValue } from '../../value_checker'\n\nfunction run(): void {\n const exit = (exitCode: number, error?: Error, message?: string): void => {\n if (doesHaveValue(error)) {\n console.error(VError.fullStack(new VError(error, message))) // eslint-disable-line no-console\n }\n process.exit(exitCode)\n }\n const worker = new Worker({\n id: process.env.CUCUMBER_WORKER_ID,\n sendMessage: (message: any) => process.send(message),\n cwd: process.cwd(),\n exit,\n })\n process.on('message', (m: any): void => {\n worker\n .receiveMessage(m)\n .catch((error: Error) =>\n exit(1, error, 'Unexpected error on worker.receiveMessage')\n )\n })\n}\n\nrun()\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ICoordinatorReport, IWorkerCommand, IWorkerCommandInitialize, IWorkerCommandRun } from './command_types';
|
|
2
|
+
type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
|
|
3
|
+
type IMessageSender = (command: ICoordinatorReport) => void;
|
|
4
|
+
export default class Worker {
|
|
5
|
+
private readonly cwd;
|
|
6
|
+
private readonly exit;
|
|
7
|
+
private readonly id;
|
|
8
|
+
private readonly eventBroadcaster;
|
|
9
|
+
private filterStacktraces;
|
|
10
|
+
private readonly newId;
|
|
11
|
+
private readonly sendMessage;
|
|
12
|
+
private supportCodeLibrary;
|
|
13
|
+
private worldParameters;
|
|
14
|
+
private runTestRunHooks;
|
|
15
|
+
constructor({ cwd, exit, id, sendMessage, }: {
|
|
16
|
+
cwd: string;
|
|
17
|
+
exit: IExitFunction;
|
|
18
|
+
id: string;
|
|
19
|
+
sendMessage: IMessageSender;
|
|
20
|
+
});
|
|
21
|
+
initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }: IWorkerCommandInitialize): Promise<void>;
|
|
22
|
+
finalize(): Promise<void>;
|
|
23
|
+
receiveMessage(message: IWorkerCommand): Promise<void>;
|
|
24
|
+
runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip, }: IWorkerCommandRun): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
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 messages_1 = require("@cucumber/messages");
|
|
7
|
+
const events_1 = require("events");
|
|
8
|
+
const url_1 = require("url");
|
|
9
|
+
const support_code_library_builder_1 = __importDefault(require("../../support_code_library_builder"));
|
|
10
|
+
const value_checker_1 = require("../../value_checker");
|
|
11
|
+
const run_test_run_hooks_1 = require("../run_test_run_hooks");
|
|
12
|
+
const stopwatch_1 = require("../stopwatch");
|
|
13
|
+
const test_case_runner_1 = __importDefault(require("../test_case_runner"));
|
|
14
|
+
const try_require_1 = __importDefault(require("../../try_require"));
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
16
|
+
const { importer } = require('../../importer');
|
|
17
|
+
const { uuid } = messages_1.IdGenerator;
|
|
18
|
+
class Worker {
|
|
19
|
+
constructor({ cwd, exit, id, sendMessage, }) {
|
|
20
|
+
this.id = id;
|
|
21
|
+
this.newId = uuid();
|
|
22
|
+
this.cwd = cwd;
|
|
23
|
+
this.exit = exit;
|
|
24
|
+
this.sendMessage = sendMessage;
|
|
25
|
+
this.eventBroadcaster = new events_1.EventEmitter();
|
|
26
|
+
this.eventBroadcaster.on('envelope', (envelope) => {
|
|
27
|
+
// assign `workerId` property only for the `testCaseStarted` message
|
|
28
|
+
if (envelope.testCaseStarted) {
|
|
29
|
+
envelope.testCaseStarted.workerId = this.id;
|
|
30
|
+
}
|
|
31
|
+
this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) });
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async initialize({ filterStacktraces, requireModules, requirePaths, importPaths, supportCodeIds, options, }) {
|
|
35
|
+
support_code_library_builder_1.default.reset(this.cwd, this.newId, {
|
|
36
|
+
requireModules,
|
|
37
|
+
requirePaths,
|
|
38
|
+
importPaths,
|
|
39
|
+
});
|
|
40
|
+
requireModules.map((module) => (0, try_require_1.default)(module));
|
|
41
|
+
requirePaths.map((module) => (0, try_require_1.default)(module));
|
|
42
|
+
for (const path of importPaths) {
|
|
43
|
+
await importer((0, url_1.pathToFileURL)(path));
|
|
44
|
+
}
|
|
45
|
+
this.supportCodeLibrary = support_code_library_builder_1.default.finalize(supportCodeIds);
|
|
46
|
+
this.worldParameters = options.worldParameters;
|
|
47
|
+
this.filterStacktraces = filterStacktraces;
|
|
48
|
+
this.runTestRunHooks = (0, run_test_run_hooks_1.makeRunTestRunHooks)(options.dryRun, this.supportCodeLibrary.defaultTimeout, (name, location) => `${name} hook errored on worker ${this.id}, process exiting: ${location}`);
|
|
49
|
+
await this.runTestRunHooks(this.supportCodeLibrary.beforeTestRunHookDefinitions, 'a BeforeAll');
|
|
50
|
+
this.sendMessage({ ready: true });
|
|
51
|
+
}
|
|
52
|
+
async finalize() {
|
|
53
|
+
await this.runTestRunHooks(this.supportCodeLibrary.afterTestRunHookDefinitions, 'an AfterAll');
|
|
54
|
+
this.exit(0);
|
|
55
|
+
}
|
|
56
|
+
async receiveMessage(message) {
|
|
57
|
+
if ((0, value_checker_1.doesHaveValue)(message.initialize)) {
|
|
58
|
+
await this.initialize(message.initialize);
|
|
59
|
+
}
|
|
60
|
+
else if (message.finalize) {
|
|
61
|
+
await this.finalize();
|
|
62
|
+
}
|
|
63
|
+
else if ((0, value_checker_1.doesHaveValue)(message.run)) {
|
|
64
|
+
await this.runTestCase(message.run);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async runTestCase({ gherkinDocument, pickle, testCase, elapsed, retries, skip, }) {
|
|
68
|
+
const stopwatch = (0, stopwatch_1.create)(elapsed);
|
|
69
|
+
const testCaseRunner = new test_case_runner_1.default({
|
|
70
|
+
eventBroadcaster: this.eventBroadcaster,
|
|
71
|
+
stopwatch,
|
|
72
|
+
gherkinDocument,
|
|
73
|
+
newId: this.newId,
|
|
74
|
+
pickle,
|
|
75
|
+
testCase,
|
|
76
|
+
retries,
|
|
77
|
+
skip,
|
|
78
|
+
filterStackTraces: this.filterStacktraces,
|
|
79
|
+
supportCodeLibrary: this.supportCodeLibrary,
|
|
80
|
+
worldParameters: this.worldParameters,
|
|
81
|
+
});
|
|
82
|
+
await testCaseRunner.run();
|
|
83
|
+
this.sendMessage({ ready: true });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.default = Worker;
|
|
87
|
+
//# sourceMappingURL=worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;AACA,iDAAgD;AAChD,mCAAqC;AACrC,6BAAmC;AACnC,sGAA0E;AAE1E,uDAAmD;AACnD,8DAA6E;AAC7E,4CAAqC;AACrC,2EAAgD;AAOhD,oEAA0C;AAE1C,8DAA8D;AAC9D,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAA;AAK5B,MAAqB,MAAM;IAazB,YAAY,EACV,GAAG,EACH,IAAI,EACJ,EAAE,EACF,WAAW,GAMZ;QACC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,CAAA;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,qBAAY,EAAE,CAAA;QAC1C,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACnE,oEAAoE;YACpE,IAAI,QAAQ,CAAC,eAAe,EAAE;gBAC5B,QAAQ,CAAC,eAAe,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAA;aAC5C;YACD,IAAI,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CAAC;CACF;AArHD,yBAqHC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { IdGenerator } from '@cucumber/messages'\nimport { EventEmitter } from 'events'\nimport { pathToFileURL } from 'url'\nimport supportCodeLibraryBuilder from '../../support_code_library_builder'\nimport { ISupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { doesHaveValue } from '../../value_checker'\nimport { makeRunTestRunHooks, RunsTestRunHooks } from '../run_test_run_hooks'\nimport { create } from '../stopwatch'\nimport TestCaseRunner from '../test_case_runner'\nimport {\n ICoordinatorReport,\n IWorkerCommand,\n IWorkerCommandInitialize,\n IWorkerCommandRun,\n} from './command_types'\nimport tryRequire from '../../try_require'\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { importer } = require('../../importer')\nconst { uuid } = IdGenerator\n\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void\ntype IMessageSender = (command: ICoordinatorReport) => void\n\nexport default class Worker {\n private readonly cwd: string\n private readonly exit: IExitFunction\n\n private readonly id: string\n private readonly eventBroadcaster: EventEmitter\n private filterStacktraces: boolean\n private readonly newId: IdGenerator.NewId\n private readonly sendMessage: IMessageSender\n private supportCodeLibrary: ISupportCodeLibrary\n private worldParameters: any\n private runTestRunHooks: RunsTestRunHooks\n\n constructor({\n cwd,\n exit,\n id,\n sendMessage,\n }: {\n cwd: string\n exit: IExitFunction\n id: string\n sendMessage: IMessageSender\n }) {\n this.id = id\n this.newId = uuid()\n this.cwd = cwd\n this.exit = exit\n this.sendMessage = sendMessage\n this.eventBroadcaster = new EventEmitter()\n this.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n // assign `workerId` property only for the `testCaseStarted` message\n if (envelope.testCaseStarted) {\n envelope.testCaseStarted.workerId = this.id\n }\n this.sendMessage({ jsonEnvelope: JSON.stringify(envelope) })\n })\n }\n\n async initialize({\n filterStacktraces,\n requireModules,\n requirePaths,\n importPaths,\n supportCodeIds,\n options,\n }: IWorkerCommandInitialize): Promise<void> {\n supportCodeLibraryBuilder.reset(this.cwd, this.newId, {\n requireModules,\n requirePaths,\n importPaths,\n })\n requireModules.map((module) => tryRequire(module))\n requirePaths.map((module) => tryRequire(module))\n for (const path of importPaths) {\n await importer(pathToFileURL(path))\n }\n this.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds)\n\n this.worldParameters = options.worldParameters\n this.filterStacktraces = filterStacktraces\n this.runTestRunHooks = makeRunTestRunHooks(\n options.dryRun,\n this.supportCodeLibrary.defaultTimeout,\n (name, location) =>\n `${name} hook errored on worker ${this.id}, process exiting: ${location}`\n )\n await this.runTestRunHooks(\n this.supportCodeLibrary.beforeTestRunHookDefinitions,\n 'a BeforeAll'\n )\n this.sendMessage({ ready: true })\n }\n\n async finalize(): Promise<void> {\n await this.runTestRunHooks(\n this.supportCodeLibrary.afterTestRunHookDefinitions,\n 'an AfterAll'\n )\n this.exit(0)\n }\n\n async receiveMessage(message: IWorkerCommand): Promise<void> {\n if (doesHaveValue(message.initialize)) {\n await this.initialize(message.initialize)\n } else if (message.finalize) {\n await this.finalize()\n } else if (doesHaveValue(message.run)) {\n await this.runTestCase(message.run)\n }\n }\n\n async runTestCase({\n gherkinDocument,\n pickle,\n testCase,\n elapsed,\n retries,\n skip,\n }: IWorkerCommandRun): Promise<void> {\n const stopwatch = create(elapsed)\n const testCaseRunner = new TestCaseRunner({\n eventBroadcaster: this.eventBroadcaster,\n stopwatch,\n gherkinDocument,\n newId: this.newId,\n pickle,\n testCase,\n retries,\n skip,\n filterStackTraces: this.filterStacktraces,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.worldParameters,\n })\n await testCaseRunner.run()\n this.sendMessage({ ready: true })\n }\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import TestRunHookDefinition from '../models/test_run_hook_definition';
|
|
2
|
+
export type RunsTestRunHooks = (definitions: TestRunHookDefinition[], name: string) => Promise<void>;
|
|
3
|
+
export declare const makeRunTestRunHooks: (dryRun: boolean, defaultTimeout: number, errorMessage: (name: string, location: string) => string) => RunsTestRunHooks;
|
|
@@ -0,0 +1,28 @@
|
|
|
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.makeRunTestRunHooks = void 0;
|
|
7
|
+
const user_code_runner_1 = __importDefault(require("../user_code_runner"));
|
|
8
|
+
const verror_1 = __importDefault(require("verror"));
|
|
9
|
+
const helpers_1 = require("../formatter/helpers");
|
|
10
|
+
const value_checker_1 = require("../value_checker");
|
|
11
|
+
const makeRunTestRunHooks = (dryRun, defaultTimeout, errorMessage) => dryRun
|
|
12
|
+
? async () => { }
|
|
13
|
+
: async (definitions, name) => {
|
|
14
|
+
for (const hookDefinition of definitions) {
|
|
15
|
+
const { error } = await user_code_runner_1.default.run({
|
|
16
|
+
argsArray: [],
|
|
17
|
+
fn: hookDefinition.code,
|
|
18
|
+
thisArg: null,
|
|
19
|
+
timeoutInMilliseconds: (0, value_checker_1.valueOrDefault)(hookDefinition.options.timeout, defaultTimeout),
|
|
20
|
+
});
|
|
21
|
+
if ((0, value_checker_1.doesHaveValue)(error)) {
|
|
22
|
+
const location = (0, helpers_1.formatLocation)(hookDefinition);
|
|
23
|
+
throw new verror_1.default(error, errorMessage(name, location));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.makeRunTestRunHooks = makeRunTestRunHooks;
|
|
28
|
+
//# sourceMappingURL=run_test_run_hooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run_test_run_hooks.js","sourceRoot":"","sources":["../../src/runtime/run_test_run_hooks.ts"],"names":[],"mappings":";;;;;;AAAA,2EAAgD;AAChD,oDAA2B;AAC3B,kDAAqD;AACrD,oDAAgE;AAQzD,MAAM,mBAAmB,GAAG,CACjC,MAAe,EACf,cAAsB,EACtB,YAAwD,EACtC,EAAE,CACpB,MAAM;IACJ,CAAC,CAAC,KAAK,IAAI,EAAE,GAAE,CAAC;IAChB,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE;QAC1B,KAAK,MAAM,cAAc,IAAI,WAAW,EAAE;YACxC,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,0BAAc,CAAC,GAAG,CAAC;gBACzC,SAAS,EAAE,EAAE;gBACb,EAAE,EAAE,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,IAAI;gBACb,qBAAqB,EAAE,IAAA,8BAAc,EACnC,cAAc,CAAC,OAAO,CAAC,OAAO,EAC9B,cAAc,CACf;aACF,CAAC,CAAA;YACF,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE;gBACxB,MAAM,QAAQ,GAAG,IAAA,wBAAc,EAAC,cAAc,CAAC,CAAA;gBAC/C,MAAM,IAAI,gBAAM,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;aACtD;SACF;IACH,CAAC,CAAA;AAvBM,QAAA,mBAAmB,uBAuBzB","sourcesContent":["import UserCodeRunner from '../user_code_runner'\nimport VError from 'verror'\nimport { formatLocation } from '../formatter/helpers'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\n\nexport type RunsTestRunHooks = (\n definitions: TestRunHookDefinition[],\n name: string\n) => Promise<void>\n\nexport const makeRunTestRunHooks = (\n dryRun: boolean,\n defaultTimeout: number,\n errorMessage: (name: string, location: string) => string\n): RunsTestRunHooks =>\n dryRun\n ? async () => {}\n : async (definitions, name) => {\n for (const hookDefinition of definitions) {\n const { error } = await UserCodeRunner.run({\n argsArray: [],\n fn: hookDefinition.code,\n thisArg: null,\n timeoutInMilliseconds: valueOrDefault(\n hookDefinition.options.timeout,\n defaultTimeout\n ),\n })\n if (doesHaveValue(error)) {\n const location = formatLocation(hookDefinition)\n throw new VError(error, errorMessage(name, location))\n }\n }\n }\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as messages from '@cucumber/messages';
|
|
2
|
+
import { ITestCaseHookParameter } from '../support_code_library_builder/types';
|
|
3
|
+
import { IDefinition } from '../models/definition';
|
|
4
|
+
export interface IRunOptions {
|
|
5
|
+
defaultTimeout: number;
|
|
6
|
+
filterStackTraces: boolean;
|
|
7
|
+
hookParameter: ITestCaseHookParameter;
|
|
8
|
+
step: messages.PickleStep;
|
|
9
|
+
stepDefinition: IDefinition;
|
|
10
|
+
world: any;
|
|
11
|
+
}
|
|
12
|
+
export declare function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }: IRunOptions): Promise<messages.TestStepResult>;
|
|
13
|
+
declare const _default: {
|
|
14
|
+
run: typeof run;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
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.run = void 0;
|
|
30
|
+
const stopwatch_1 = require("./stopwatch");
|
|
31
|
+
const user_code_runner_1 = __importDefault(require("../user_code_runner"));
|
|
32
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
33
|
+
const value_checker_1 = require("../value_checker");
|
|
34
|
+
const format_error_1 = require("./format_error");
|
|
35
|
+
async function run({ defaultTimeout, filterStackTraces, hookParameter, step, stepDefinition, world, }) {
|
|
36
|
+
const stopwatch = (0, stopwatch_1.create)().start();
|
|
37
|
+
let error, result, invocationData;
|
|
38
|
+
try {
|
|
39
|
+
invocationData = await stepDefinition.getInvocationParameters({
|
|
40
|
+
hookParameter,
|
|
41
|
+
step,
|
|
42
|
+
world,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
error = err;
|
|
47
|
+
}
|
|
48
|
+
if ((0, value_checker_1.doesNotHaveValue)(error)) {
|
|
49
|
+
const timeoutInMilliseconds = (0, value_checker_1.valueOrDefault)(stepDefinition.options.timeout, defaultTimeout);
|
|
50
|
+
if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {
|
|
51
|
+
const data = await user_code_runner_1.default.run({
|
|
52
|
+
argsArray: invocationData.parameters,
|
|
53
|
+
fn: stepDefinition.code,
|
|
54
|
+
thisArg: world,
|
|
55
|
+
timeoutInMilliseconds,
|
|
56
|
+
});
|
|
57
|
+
error = data.error;
|
|
58
|
+
result = data.result;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
error = invocationData.getInvalidCodeLengthMessage();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const duration = stopwatch.stop().duration();
|
|
65
|
+
let status;
|
|
66
|
+
let details = {};
|
|
67
|
+
if (result === 'skipped') {
|
|
68
|
+
status = messages.TestStepResultStatus.SKIPPED;
|
|
69
|
+
}
|
|
70
|
+
else if (result === 'pending') {
|
|
71
|
+
status = messages.TestStepResultStatus.PENDING;
|
|
72
|
+
}
|
|
73
|
+
else if ((0, value_checker_1.doesHaveValue)(error)) {
|
|
74
|
+
details = (0, format_error_1.formatError)(error, filterStackTraces);
|
|
75
|
+
status = messages.TestStepResultStatus.FAILED;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
status = messages.TestStepResultStatus.PASSED;
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
duration,
|
|
82
|
+
status,
|
|
83
|
+
...details,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
exports.run = run;
|
|
87
|
+
exports.default = { run };
|
|
88
|
+
//# sourceMappingURL=step_runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step_runner.js","sourceRoot":"","sources":["../../src/runtime/step_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAoC;AACpC,2EAAgD;AAChD,6DAA8C;AAG9C,oDAIyB;AACzB,iDAA4C;AAWrC,KAAK,UAAU,GAAG,CAAC,EACxB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,cAAc,EACd,KAAK,GACO;IACZ,MAAM,SAAS,GAAG,IAAA,kBAAM,GAAE,CAAC,KAAK,EAAE,CAAA;IAClC,IAAI,KAAU,EAAE,MAAW,EAAE,cAA0C,CAAA;IAEvE,IAAI;QACF,cAAc,GAAG,MAAM,cAAc,CAAC,uBAAuB,CAAC;YAC5D,aAAa;YACb,IAAI;YACJ,KAAK;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BAAoB,CAAC,MAAM,CAAA;KAC9C;IAED,OAAO;QACL,QAAQ;QACR,MAAM;QACN,GAAG,OAAO;KACX,CAAA;AACH,CAAC;AA5DD,kBA4DC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import { create } from './stopwatch'\nimport UserCodeRunner from '../user_code_runner'\nimport * as messages from '@cucumber/messages'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { IDefinition, IGetInvocationDataResponse } from '../models/definition'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport { formatError } from './format_error'\n\nexport interface IRunOptions {\n defaultTimeout: number\n filterStackTraces: boolean\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n stepDefinition: IDefinition\n world: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<messages.TestStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\n } catch (err) {\n error = err\n }\n\n if (doesNotHaveValue(error)) {\n const timeoutInMilliseconds = valueOrDefault(\n stepDefinition.options.timeout,\n defaultTimeout\n )\n\n if (invocationData.validCodeLengths.includes(stepDefinition.code.length)) {\n const data = await UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\n error = data.error\n result = data.result\n } else {\n error = invocationData.getInvalidCodeLengthMessage()\n }\n }\n\n const duration = stopwatch.stop().duration()\n let status: messages.TestStepResultStatus\n let details = {}\n if (result === 'skipped') {\n status = messages.TestStepResultStatus.SKIPPED\n } else if (result === 'pending') {\n status = messages.TestStepResultStatus.PENDING\n } else if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n return {\n duration,\n status,\n ...details,\n }\n}\n\nexport default { run }\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Duration, Timestamp } from '@cucumber/messages';
|
|
2
|
+
/**
|
|
3
|
+
* A utility for timing test run operations and returning duration and
|
|
4
|
+
* timestamp objects in messages-compatible formats
|
|
5
|
+
*/
|
|
6
|
+
export interface IStopwatch {
|
|
7
|
+
start: () => IStopwatch;
|
|
8
|
+
stop: () => IStopwatch;
|
|
9
|
+
duration: () => Duration;
|
|
10
|
+
timestamp: () => Timestamp;
|
|
11
|
+
}
|
|
12
|
+
export declare const create: (base?: Duration) => IStopwatch;
|
|
@@ -0,0 +1,34 @@
|
|
|
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.create = void 0;
|
|
7
|
+
const messages_1 = require("@cucumber/messages");
|
|
8
|
+
const time_1 = __importDefault(require("../time"));
|
|
9
|
+
class StopwatchImpl {
|
|
10
|
+
constructor(base = { seconds: 0, nanos: 0 }) {
|
|
11
|
+
this.base = base;
|
|
12
|
+
}
|
|
13
|
+
start() {
|
|
14
|
+
this.started = time_1.default.performance.now();
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
17
|
+
stop() {
|
|
18
|
+
this.base = this.duration();
|
|
19
|
+
this.started = undefined;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
duration() {
|
|
23
|
+
if (typeof this.started !== 'number') {
|
|
24
|
+
return this.base;
|
|
25
|
+
}
|
|
26
|
+
return messages_1.TimeConversion.addDurations(this.base, messages_1.TimeConversion.millisecondsToDuration(time_1.default.performance.now() - this.started));
|
|
27
|
+
}
|
|
28
|
+
timestamp() {
|
|
29
|
+
return messages_1.TimeConversion.millisecondsSinceEpochToTimestamp(time_1.default.Date.now());
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const create = (base) => new StopwatchImpl(base);
|
|
33
|
+
exports.create = create;
|
|
34
|
+
//# sourceMappingURL=stopwatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopwatch.js","sourceRoot":"","sources":["../../src/runtime/stopwatch.ts"],"names":[],"mappings":";;;;;;AAAA,iDAAwE;AACxE,mDAA6B;AAa7B,MAAM,aAAa;IAGjB,YAAoB,OAAiB,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE;QAAzC,SAAI,GAAJ,IAAI,CAAqC;IAAG,CAAC;IAEjE,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,cAAO,CAAC,WAAW,CAAC,GAAG,EAAE,CAAA;QACxC,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI;QACF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QAC3B,IAAI,CAAC,OAAO,GAAG,SAAS,CAAA;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,QAAQ;QACN,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE;YACpC,OAAO,IAAI,CAAC,IAAI,CAAA;SACjB;QACD,OAAO,yBAAc,CAAC,YAAY,CAChC,IAAI,CAAC,IAAI,EACT,yBAAc,CAAC,sBAAsB,CACnC,cAAO,CAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CACzC,CACF,CAAA;IACH,CAAC;IAED,SAAS;QACP,OAAO,yBAAc,CAAC,iCAAiC,CAAC,cAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IAC7E,CAAC;CACF;AAEM,MAAM,MAAM,GAAG,CAAC,IAAe,EAAc,EAAE,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAA;AAAjE,QAAA,MAAM,UAA2D","sourcesContent":["import { Duration, TimeConversion, Timestamp } from '@cucumber/messages'\nimport methods from '../time'\n\n/**\n * A utility for timing test run operations and returning duration and\n * timestamp objects in messages-compatible formats\n */\nexport interface IStopwatch {\n start: () => IStopwatch\n stop: () => IStopwatch\n duration: () => Duration\n timestamp: () => Timestamp\n}\n\nclass StopwatchImpl implements IStopwatch {\n private started: number\n\n constructor(private base: Duration = { seconds: 0, nanos: 0 }) {}\n\n start(): IStopwatch {\n this.started = methods.performance.now()\n return this\n }\n\n stop(): IStopwatch {\n this.base = this.duration()\n this.started = undefined\n return this\n }\n\n duration(): Duration {\n if (typeof this.started !== 'number') {\n return this.base\n }\n return TimeConversion.addDurations(\n this.base,\n TimeConversion.millisecondsToDuration(\n methods.performance.now() - this.started\n )\n )\n }\n\n timestamp(): Timestamp {\n return TimeConversion.millisecondsSinceEpochToTimestamp(methods.Date.now())\n }\n}\n\nexport const create = (base?: Duration): IStopwatch => new StopwatchImpl(base)\n"]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as messages from '@cucumber/messages';
|
|
3
|
+
import { IdGenerator } from '@cucumber/messages';
|
|
4
|
+
import { EventEmitter } from 'events';
|
|
5
|
+
import { ISupportCodeLibrary, ITestCaseHookParameter } from '../support_code_library_builder/types';
|
|
6
|
+
import TestCaseHookDefinition from '../models/test_case_hook_definition';
|
|
7
|
+
import TestStepHookDefinition from '../models/test_step_hook_definition';
|
|
8
|
+
import { IDefinition } from '../models/definition';
|
|
9
|
+
import { IStopwatch } from './stopwatch';
|
|
10
|
+
export interface INewTestCaseRunnerOptions {
|
|
11
|
+
eventBroadcaster: EventEmitter;
|
|
12
|
+
stopwatch: IStopwatch;
|
|
13
|
+
gherkinDocument: messages.GherkinDocument;
|
|
14
|
+
newId: IdGenerator.NewId;
|
|
15
|
+
pickle: messages.Pickle;
|
|
16
|
+
testCase: messages.TestCase;
|
|
17
|
+
retries: number;
|
|
18
|
+
skip: boolean;
|
|
19
|
+
filterStackTraces: boolean;
|
|
20
|
+
supportCodeLibrary: ISupportCodeLibrary;
|
|
21
|
+
worldParameters: any;
|
|
22
|
+
}
|
|
23
|
+
export default class TestCaseRunner {
|
|
24
|
+
private readonly attachmentManager;
|
|
25
|
+
private currentTestCaseStartedId;
|
|
26
|
+
private currentTestStepId;
|
|
27
|
+
private readonly eventBroadcaster;
|
|
28
|
+
private readonly stopwatch;
|
|
29
|
+
private readonly gherkinDocument;
|
|
30
|
+
private readonly newId;
|
|
31
|
+
private readonly pickle;
|
|
32
|
+
private readonly testCase;
|
|
33
|
+
private readonly maxAttempts;
|
|
34
|
+
private readonly skip;
|
|
35
|
+
private readonly filterStackTraces;
|
|
36
|
+
private readonly supportCodeLibrary;
|
|
37
|
+
private testStepResults;
|
|
38
|
+
private world;
|
|
39
|
+
private readonly worldParameters;
|
|
40
|
+
private reportGenerator;
|
|
41
|
+
constructor({ eventBroadcaster, stopwatch, gherkinDocument, newId, pickle, testCase, retries, skip, filterStackTraces, supportCodeLibrary, worldParameters, }: INewTestCaseRunnerOptions);
|
|
42
|
+
resetTestProgressData(): void;
|
|
43
|
+
getBeforeStepHookDefinitions(): TestStepHookDefinition[];
|
|
44
|
+
getAfterStepHookDefinitions(): TestStepHookDefinition[];
|
|
45
|
+
getWorstStepResult(): messages.TestStepResult;
|
|
46
|
+
invokeStep(step: messages.PickleStep, stepDefinition: IDefinition, hookParameter?: any): Promise<messages.TestStepResult>;
|
|
47
|
+
isSkippingSteps(): boolean;
|
|
48
|
+
shouldSkipHook(isBeforeHook: boolean): boolean;
|
|
49
|
+
aroundTestStep(testStepId: string, runStepFn: () => Promise<messages.TestStepResult>): Promise<void>;
|
|
50
|
+
run(): Promise<messages.TestStepResultStatus>;
|
|
51
|
+
runAttempt(attempt: number, moreAttemptsRemaining: boolean): Promise<boolean>;
|
|
52
|
+
runHook(hookDefinition: TestCaseHookDefinition, hookParameter: ITestCaseHookParameter, isBeforeHook: boolean): Promise<messages.TestStepResult>;
|
|
53
|
+
runStepHooks(stepHooks: TestStepHookDefinition[], pickleStep: messages.PickleStep, stepResult?: messages.TestStepResult): Promise<messages.TestStepResult[]>;
|
|
54
|
+
runStep(pickleStep: messages.PickleStep, testStep: messages.TestStep): Promise<messages.TestStepResult>;
|
|
55
|
+
}
|