@cucumber/cucumber 12.9.0 → 13.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/bin/cucumber.js +2 -1
- package/lib/api/convert_configuration.d.ts +3 -4
- package/lib/api/convert_configuration.js +9 -11
- package/lib/api/emit_support_code_messages.d.ts +3 -3
- package/lib/api/emit_support_code_messages.js +16 -65
- package/lib/api/formatters.d.ts +7 -7
- package/lib/api/formatters.js +5 -2
- package/lib/api/gherkin.d.ts +3 -3
- package/lib/api/gherkin.js +2 -4
- package/lib/api/index.d.ts +2 -2
- package/lib/api/index.js +1 -1
- package/lib/api/load_configuration.d.ts +2 -2
- package/lib/api/load_configuration.js +4 -5
- package/lib/api/load_sources.d.ts +2 -2
- package/lib/api/load_sources.js +2 -2
- package/lib/api/load_support.d.ts +2 -2
- package/lib/api/load_support.js +3 -3
- package/lib/api/plugins.d.ts +2 -2
- package/lib/api/plugins.js +2 -2
- package/lib/api/run_cucumber.d.ts +3 -3
- package/lib/api/run_cucumber.js +19 -3
- package/lib/api/support.d.ts +3 -3
- package/lib/api/support.js +5 -5
- package/lib/api/test_helpers.d.ts +1 -1
- package/lib/api/test_helpers.js +8 -10
- package/lib/api/types.d.ts +9 -5
- package/lib/api/types.js +1 -1
- package/lib/api/wrapper.d.mts +5 -0
- package/lib/api/wrapper.mjs +6 -6
- package/lib/assemble/assemble_test_cases.d.ts +4 -4
- package/lib/assemble/assemble_test_cases.js +2 -6
- package/lib/assemble/index.js +1 -1
- package/lib/assemble/types.d.ts +1 -1
- package/lib/assemble/types.js +1 -1
- package/lib/cli/i18n.js +5 -3
- package/lib/cli/index.d.ts +1 -1
- package/lib/cli/index.js +2 -2
- package/lib/cli/install_validator.js +4 -3
- package/lib/cli/run.js +7 -6
- package/lib/cli/validate_node_engine_version.js +2 -4
- package/lib/configuration/argv_parser.d.ts +1 -1
- package/lib/configuration/argv_parser.js +7 -7
- package/lib/configuration/check_schema.d.ts +1 -1
- package/lib/configuration/check_schema.js +17 -6
- package/lib/configuration/default_configuration.d.ts +1 -1
- package/lib/configuration/default_configuration.js +2 -1
- package/lib/configuration/from_file.d.ts +2 -2
- package/lib/configuration/from_file.js +6 -6
- package/lib/configuration/helpers.js +1 -1
- package/lib/configuration/index.js +1 -1
- package/lib/configuration/locate_file.js +3 -3
- package/lib/configuration/merge_configurations.d.ts +1 -1
- package/lib/configuration/merge_configurations.js +2 -10
- package/lib/configuration/parse_configuration.d.ts +2 -2
- package/lib/configuration/parse_configuration.js +3 -11
- package/lib/configuration/split_format_descriptor.d.ts +1 -2
- package/lib/configuration/split_format_descriptor.js +11 -71
- package/lib/configuration/types.d.ts +26 -3
- package/lib/configuration/types.js +1 -1
- package/lib/configuration/validate_configuration.d.ts +2 -2
- package/lib/configuration/validate_configuration.js +5 -3
- package/lib/environment/console_logger.d.ts +2 -2
- package/lib/environment/console_logger.js +1 -1
- package/lib/environment/index.js +1 -1
- package/lib/environment/make_environment.d.ts +1 -1
- package/lib/environment/make_environment.js +1 -1
- package/lib/environment/types.d.ts +1 -1
- package/lib/environment/types.js +1 -1
- package/lib/filter/filter_plugin.d.ts +1 -1
- package/lib/filter/filter_plugin.js +1 -1
- package/lib/filter/index.d.ts +1 -1
- package/lib/filter/index.js +2 -2
- package/lib/filter/order_pickles.d.ts +2 -2
- package/lib/filter/order_pickles.js +1 -1
- package/lib/filter/types.d.ts +1 -1
- package/lib/filter/types.js +1 -1
- package/lib/filter_stack_trace.d.ts +1 -1
- package/lib/filter_stack_trace.js +1 -1
- package/lib/formatter/builder.d.ts +8 -7
- package/lib/formatter/builder.js +6 -7
- package/lib/formatter/builtin/html.js +2 -2
- package/lib/formatter/builtin/index.d.ts +4 -4
- package/lib/formatter/builtin/index.js +14 -13
- package/lib/formatter/builtin/message.js +2 -2
- package/lib/formatter/builtin/pretty.d.ts +6 -0
- package/lib/formatter/builtin/pretty.js +19 -0
- package/lib/formatter/builtin/progress-bar.d.ts +6 -0
- package/lib/formatter/builtin/progress-bar.js +22 -0
- package/lib/formatter/builtin/progress.d.ts +6 -0
- package/lib/formatter/builtin/progress.js +18 -0
- package/lib/formatter/builtin/resolve_terminal_options.d.ts +3 -0
- package/lib/formatter/builtin/resolve_terminal_options.js +15 -0
- package/lib/formatter/builtin/summary.d.ts +6 -0
- package/lib/formatter/builtin/summary.js +15 -0
- package/lib/formatter/create_stream.d.ts +2 -2
- package/lib/formatter/create_stream.js +4 -7
- package/lib/formatter/find_class_or_plugin.js +1 -1
- package/lib/formatter/get_color_fns.d.ts +3 -3
- package/lib/formatter/get_color_fns.js +23 -52
- package/lib/formatter/helpers/duration_helpers.d.ts +1 -1
- package/lib/formatter/helpers/duration_helpers.js +1 -1
- package/lib/formatter/helpers/event_data_collector.d.ts +15 -15
- package/lib/formatter/helpers/event_data_collector.js +17 -44
- package/lib/formatter/helpers/formatters.d.ts +1 -1
- package/lib/formatter/helpers/formatters.js +1 -3
- package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -5
- package/lib/formatter/helpers/gherkin_document_parser.js +20 -18
- package/lib/formatter/helpers/index.d.ts +3 -3
- package/lib/formatter/helpers/index.js +8 -8
- package/lib/formatter/helpers/issue_helpers.d.ts +10 -10
- package/lib/formatter/helpers/issue_helpers.js +2 -2
- package/lib/formatter/helpers/keyword_type.js +2 -2
- package/lib/formatter/helpers/location_helpers.d.ts +1 -1
- package/lib/formatter/helpers/location_helpers.js +1 -1
- package/lib/formatter/helpers/pickle_parser.d.ts +10 -10
- package/lib/formatter/helpers/pickle_parser.js +8 -9
- package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -2
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/summary_helpers.d.ts +4 -4
- package/lib/formatter/helpers/summary_helpers.js +19 -48
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +4 -4
- package/lib/formatter/helpers/test_case_attempt_formatter.js +16 -49
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +9 -9
- package/lib/formatter/helpers/test_case_attempt_parser.js +12 -45
- package/lib/formatter/helpers/usage_helpers/index.d.ts +6 -6
- package/lib/formatter/helpers/usage_helpers/index.js +13 -49
- package/lib/formatter/import_code.js +2 -2
- package/lib/formatter/index.d.ts +25 -13
- package/lib/formatter/index.js +2 -2
- package/lib/formatter/json_formatter.d.ts +22 -22
- package/lib/formatter/json_formatter.js +11 -49
- package/lib/formatter/progress_formatter.d.ts +7 -3
- package/lib/formatter/progress_formatter.js +11 -41
- package/lib/formatter/rerun_formatter.d.ts +1 -1
- package/lib/formatter/rerun_formatter.js +4 -37
- package/lib/formatter/resolve_implementation.d.ts +1 -1
- package/lib/formatter/resolve_implementation.js +2 -2
- package/lib/formatter/snippets_formatter.d.ts +1 -1
- package/lib/formatter/snippets_formatter.js +4 -37
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +6 -6
- package/lib/formatter/step_definition_snippet_builder/index.js +3 -3
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +3 -5
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +1 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +1 -1
- package/lib/formatter/summary_formatter.d.ts +7 -4
- package/lib/formatter/summary_formatter.js +6 -3
- package/lib/formatter/usage_formatter.d.ts +1 -1
- package/lib/formatter/usage_formatter.js +6 -39
- package/lib/formatter/usage_json_formatter.d.ts +1 -1
- package/lib/formatter/usage_json_formatter.js +3 -3
- package/lib/index.d.ts +9 -14
- package/lib/index.js +17 -25
- package/lib/models/data_table.d.ts +2 -2
- package/lib/models/data_table.js +9 -5
- package/lib/models/definition.d.ts +5 -5
- package/lib/models/definition.js +1 -1
- package/lib/models/gherkin_step_keyword.js +1 -1
- package/lib/models/step_definition.d.ts +3 -3
- package/lib/models/step_definition.js +1 -1
- package/lib/models/test_case_hook_definition.d.ts +3 -3
- package/lib/models/test_case_hook_definition.js +1 -1
- package/lib/models/test_run_hook_definition.d.ts +1 -1
- package/lib/models/test_run_hook_definition.js +1 -1
- package/lib/models/test_step_hook_definition.d.ts +3 -3
- package/lib/models/test_step_hook_definition.js +1 -1
- package/lib/paths/index.js +1 -1
- package/lib/paths/paths.d.ts +3 -3
- package/lib/paths/paths.js +42 -18
- package/lib/paths/types.js +1 -1
- package/lib/pickle_filter.d.ts +9 -8
- package/lib/pickle_filter.js +3 -3
- package/lib/plugin/index.d.ts +1 -1
- package/lib/plugin/index.js +2 -2
- package/lib/plugin/plugin_manager.d.ts +2 -2
- package/lib/plugin/plugin_manager.js +1 -1
- package/lib/plugin/types.d.ts +59 -9
- package/lib/plugin/types.js +1 -1
- package/lib/publish/index.js +1 -1
- package/lib/publish/publish_plugin.d.ts +1 -1
- package/lib/publish/publish_plugin.js +14 -15
- package/lib/publish/types.js +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +3 -3
- package/lib/runtime/attachment_manager/index.js +12 -48
- package/lib/runtime/coordinator.d.ts +16 -8
- package/lib/runtime/coordinator.js +38 -19
- package/lib/runtime/format_error.d.ts +1 -1
- package/lib/runtime/format_error.js +43 -15
- package/lib/runtime/helpers.d.ts +5 -5
- package/lib/runtime/helpers.js +6 -39
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/make_runtime.d.ts +10 -9
- package/lib/runtime/make_runtime.js +5 -6
- package/lib/runtime/make_suggestion.d.ts +2 -2
- package/lib/runtime/make_suggestion.js +1 -1
- package/lib/runtime/parallel/adapter.d.ts +30 -39
- package/lib/runtime/parallel/adapter.js +134 -120
- package/lib/runtime/parallel/test_cases_phase.d.ts +19 -0
- package/lib/runtime/parallel/test_cases_phase.js +63 -0
- package/lib/runtime/parallel/test_run_hooks_phase.d.ts +11 -0
- package/lib/runtime/parallel/test_run_hooks_phase.js +33 -0
- package/lib/runtime/parallel/types.d.ts +38 -22
- package/lib/runtime/parallel/types.js +1 -1
- package/lib/runtime/parallel/worker.mjs +65 -0
- package/lib/runtime/scope/index.js +1 -1
- package/lib/runtime/scope/make_proxy.js +1 -1
- package/lib/runtime/scope/test_case_scope.d.ts +1 -1
- package/lib/runtime/scope/test_case_scope.js +1 -1
- package/lib/runtime/scope/test_run_scope.d.ts +1 -1
- package/lib/runtime/scope/test_run_scope.js +1 -1
- package/lib/runtime/serial/adapter.d.ts +15 -9
- package/lib/runtime/serial/adapter.js +21 -9
- package/lib/runtime/step_runner.d.ts +5 -5
- package/lib/runtime/step_runner.js +7 -40
- package/lib/runtime/stopwatch.d.ts +2 -2
- package/lib/runtime/stopwatch.js +1 -1
- package/lib/runtime/test_case_runner.d.ts +20 -20
- package/lib/runtime/test_case_runner.js +31 -60
- package/lib/runtime/types.d.ts +13 -4
- package/lib/runtime/types.js +1 -1
- package/lib/runtime/worker.d.ts +14 -13
- package/lib/runtime/worker.js +26 -44
- package/lib/sharding/index.js +1 -1
- package/lib/sharding/sharding_plugin.d.ts +1 -1
- package/lib/sharding/sharding_plugin.js +1 -1
- package/lib/step_arguments.d.ts +4 -4
- package/lib/step_arguments.js +1 -1
- package/lib/support_code_library_builder/build_parameter_type.d.ts +1 -1
- package/lib/support_code_library_builder/build_parameter_type.js +5 -3
- package/lib/support_code_library_builder/context.js +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +1 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +1 -1
- package/lib/support_code_library_builder/index.d.ts +7 -8
- package/lib/support_code_library_builder/index.js +9 -9
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +1 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +3 -4
- package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +2 -2
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +1 -1
- package/lib/support_code_library_builder/types.d.ts +17 -17
- package/lib/support_code_library_builder/types.js +1 -1
- package/lib/support_code_library_builder/validate_arguments.d.ts +1 -1
- package/lib/support_code_library_builder/validate_arguments.js +1 -1
- package/lib/support_code_library_builder/world.d.ts +2 -2
- package/lib/support_code_library_builder/world.js +2 -2
- package/lib/time.d.ts +2 -2
- package/lib/time.js +6 -39
- package/lib/try_require.js +3 -2
- package/lib/types/index.js +1 -1
- package/lib/uncaught_exception_manager.js +1 -1
- package/lib/user_code_runner.d.ts +1 -1
- package/lib/user_code_runner.js +3 -3
- package/lib/value_checker.js +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +3 -3
- package/lib/wrapper.d.mts +43 -0
- package/lib/wrapper.mjs +37 -45
- package/package.json +50 -75
- package/lib/api/convert_configuration.js.map +0 -1
- package/lib/api/emit_support_code_messages.js.map +0 -1
- package/lib/api/formatters.js.map +0 -1
- package/lib/api/gherkin.js.map +0 -1
- package/lib/api/index.js.map +0 -1
- package/lib/api/load_configuration.js.map +0 -1
- package/lib/api/load_sources.js.map +0 -1
- package/lib/api/load_support.js.map +0 -1
- package/lib/api/plugins.js.map +0 -1
- package/lib/api/run_cucumber.js.map +0 -1
- package/lib/api/support.js.map +0 -1
- package/lib/api/test_helpers.js.map +0 -1
- package/lib/api/types.js.map +0 -1
- package/lib/assemble/assemble_test_cases.js.map +0 -1
- package/lib/assemble/index.js.map +0 -1
- package/lib/assemble/types.js.map +0 -1
- package/lib/cli/i18n.js.map +0 -1
- package/lib/cli/index.js.map +0 -1
- package/lib/cli/install_validator.js.map +0 -1
- package/lib/cli/run.js.map +0 -1
- package/lib/cli/validate_node_engine_version.js.map +0 -1
- package/lib/configuration/argv_parser.js.map +0 -1
- package/lib/configuration/check_schema.js.map +0 -1
- package/lib/configuration/default_configuration.js.map +0 -1
- package/lib/configuration/from_file.js.map +0 -1
- package/lib/configuration/helpers.js.map +0 -1
- package/lib/configuration/index.js.map +0 -1
- package/lib/configuration/locate_file.js.map +0 -1
- package/lib/configuration/merge_configurations.js.map +0 -1
- package/lib/configuration/parse_configuration.js.map +0 -1
- package/lib/configuration/split_format_descriptor.js.map +0 -1
- package/lib/configuration/types.js.map +0 -1
- package/lib/configuration/validate_configuration.js.map +0 -1
- package/lib/environment/console_logger.js.map +0 -1
- package/lib/environment/index.js.map +0 -1
- package/lib/environment/make_environment.js.map +0 -1
- package/lib/environment/types.js.map +0 -1
- package/lib/filter/filter_plugin.js.map +0 -1
- package/lib/filter/index.js.map +0 -1
- package/lib/filter/order_pickles.js.map +0 -1
- package/lib/filter/types.js.map +0 -1
- package/lib/filter_stack_trace.js.map +0 -1
- package/lib/formatter/builder.js.map +0 -1
- package/lib/formatter/builtin/html.js.map +0 -1
- package/lib/formatter/builtin/index.js.map +0 -1
- package/lib/formatter/builtin/message.js.map +0 -1
- package/lib/formatter/create_stream.js.map +0 -1
- package/lib/formatter/find_class_or_plugin.js.map +0 -1
- package/lib/formatter/get_color_fns.js.map +0 -1
- package/lib/formatter/helpers/duration_helpers.js.map +0 -1
- package/lib/formatter/helpers/event_data_collector.js.map +0 -1
- package/lib/formatter/helpers/formatters.js.map +0 -1
- package/lib/formatter/helpers/gherkin_document_parser.js.map +0 -1
- package/lib/formatter/helpers/index.js.map +0 -1
- package/lib/formatter/helpers/issue_helpers.js.map +0 -1
- package/lib/formatter/helpers/keyword_type.js.map +0 -1
- package/lib/formatter/helpers/location_helpers.js.map +0 -1
- package/lib/formatter/helpers/pickle_parser.js.map +0 -1
- package/lib/formatter/helpers/step_argument_formatter.js.map +0 -1
- package/lib/formatter/helpers/summary_helpers.js.map +0 -1
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +0 -1
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +0 -1
- package/lib/formatter/helpers/usage_helpers/index.js.map +0 -1
- package/lib/formatter/import_code.js.map +0 -1
- package/lib/formatter/index.js.map +0 -1
- package/lib/formatter/json_formatter.js.map +0 -1
- package/lib/formatter/progress_bar_formatter.d.ts +0 -18
- package/lib/formatter/progress_bar_formatter.js +0 -103
- package/lib/formatter/progress_bar_formatter.js.map +0 -1
- package/lib/formatter/progress_formatter.js.map +0 -1
- package/lib/formatter/rerun_formatter.js.map +0 -1
- package/lib/formatter/resolve_implementation.js.map +0 -1
- package/lib/formatter/snippets_formatter.js.map +0 -1
- package/lib/formatter/step_definition_snippet_builder/index.js.map +0 -1
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +0 -1
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +0 -1
- package/lib/formatter/summary_formatter.js.map +0 -1
- package/lib/formatter/usage_formatter.js.map +0 -1
- package/lib/formatter/usage_json_formatter.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/models/data_table.js.map +0 -1
- package/lib/models/definition.js.map +0 -1
- package/lib/models/gherkin_step_keyword.js.map +0 -1
- package/lib/models/step_definition.js.map +0 -1
- package/lib/models/test_case_hook_definition.js.map +0 -1
- package/lib/models/test_run_hook_definition.js.map +0 -1
- package/lib/models/test_step_hook_definition.js.map +0 -1
- package/lib/paths/index.js.map +0 -1
- package/lib/paths/paths.js.map +0 -1
- package/lib/paths/types.js.map +0 -1
- package/lib/pickle_filter.js.map +0 -1
- package/lib/plugin/index.js.map +0 -1
- package/lib/plugin/plugin_manager.js.map +0 -1
- package/lib/plugin/types.js.map +0 -1
- package/lib/publish/index.js.map +0 -1
- package/lib/publish/publish_plugin.js.map +0 -1
- package/lib/publish/types.js.map +0 -1
- package/lib/runtime/attachment_manager/index.js.map +0 -1
- package/lib/runtime/coordinator.js.map +0 -1
- package/lib/runtime/format_error.js.map +0 -1
- package/lib/runtime/helpers.js.map +0 -1
- package/lib/runtime/index.js.map +0 -1
- package/lib/runtime/make_runtime.js.map +0 -1
- package/lib/runtime/make_suggestion.js.map +0 -1
- package/lib/runtime/parallel/adapter.js.map +0 -1
- package/lib/runtime/parallel/run_worker.js +0 -25
- package/lib/runtime/parallel/run_worker.js.map +0 -1
- package/lib/runtime/parallel/types.js.map +0 -1
- package/lib/runtime/parallel/worker.d.ts +0 -25
- package/lib/runtime/parallel/worker.js +0 -83
- package/lib/runtime/parallel/worker.js.map +0 -1
- package/lib/runtime/scope/index.js.map +0 -1
- package/lib/runtime/scope/make_proxy.js.map +0 -1
- package/lib/runtime/scope/test_case_scope.js.map +0 -1
- package/lib/runtime/scope/test_run_scope.js.map +0 -1
- package/lib/runtime/serial/adapter.js.map +0 -1
- package/lib/runtime/step_runner.js.map +0 -1
- package/lib/runtime/stopwatch.js.map +0 -1
- package/lib/runtime/test_case_runner.js.map +0 -1
- package/lib/runtime/types.js.map +0 -1
- package/lib/runtime/worker.js.map +0 -1
- package/lib/sharding/index.js.map +0 -1
- package/lib/sharding/sharding_plugin.js.map +0 -1
- package/lib/step_arguments.js.map +0 -1
- package/lib/support_code_library_builder/build_parameter_type.js.map +0 -1
- package/lib/support_code_library_builder/context.js.map +0 -1
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +0 -1
- package/lib/support_code_library_builder/index.js.map +0 -1
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +0 -1
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +0 -1
- package/lib/support_code_library_builder/types.js.map +0 -1
- package/lib/support_code_library_builder/validate_arguments.js.map +0 -1
- package/lib/support_code_library_builder/world.js.map +0 -1
- package/lib/time.js.map +0 -1
- package/lib/try_require.js.map +0 -1
- package/lib/tsconfig.node.tsbuildinfo +0 -1
- package/lib/types/index.js.map +0 -1
- package/lib/uncaught_exception_manager.js.map +0 -1
- package/lib/user_code_runner.js.map +0 -1
- package/lib/value_checker.js.map +0 -1
- package/lib/version.js.map +0 -1
- /package/lib/runtime/parallel/{run_worker.d.ts → worker.d.mts} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin_manager.js","sourceRoot":"","sources":["../../src/plugin/plugin_manager.ts"],"names":[],"mappings":";;;AAuCA,MAAa,aAAa;IAYK;IAXZ,QAAQ,GAAoB;QAC3C,OAAO,EAAE,EAAE;QACX,eAAe,EAAE,EAAE;QACnB,aAAa,EAAE,EAAE;KAClB,CAAA;IACgB,YAAY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AC;AACH,CAAC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorContext,\n CoordinatorEventHandler,\n CoordinatorEventKey,\n CoordinatorEventValues,\n CoordinatorTransformer,\n CoordinatorTransformKey,\n CoordinatorTransformValues,\n FormatterPlugin,\n InternalPlugin,\n Plugin,\n PluginCleanup,\n PluginOperation,\n} from './types'\n\ntype SourcedEventHandler<K extends CoordinatorEventKey> = {\n handler: CoordinatorEventHandler<K>\n specifier?: string\n}\n\ntype SourcedTransformer<K extends CoordinatorTransformKey> = {\n transformer: CoordinatorTransformer<K>\n specifier?: string\n}\n\ntype SourcedCleanup = {\n cleanupFn: PluginCleanup\n specifier?: string\n}\n\ntype HandlerRegistry = {\n [K in CoordinatorEventKey]: Array<SourcedEventHandler<K>>\n}\n\ntype TransformerRegistry = {\n [K in CoordinatorTransformKey]: Array<SourcedTransformer<K>>\n}\n\nexport class PluginManager {\n private readonly handlers: HandlerRegistry = {\n message: [],\n 'paths:resolve': [],\n 'publish:url': [],\n }\n private readonly transformers: TransformerRegistry = {\n 'pickles:filter': [],\n 'pickles:order': [],\n }\n private cleanupFns: SourcedCleanup[] = []\n\n constructor(private readonly environment: UsableEnvironment) {}\n\n private async registerHandler<K extends CoordinatorEventKey>(\n event: K,\n handler: CoordinatorEventHandler<K>,\n specifier?: string\n ) {\n if (!this.handlers[event]) {\n throw new Error(`Cannot register handler for unknown event \"${event}\"`)\n }\n this.handlers[event].push({\n handler,\n specifier,\n })\n }\n\n private async registerTransformer<K extends CoordinatorTransformKey>(\n event: K,\n transformer: CoordinatorTransformer<K>,\n specifier?: string\n ) {\n if (!this.transformers[event]) {\n throw new Error(\n `Cannot register transformer for unknown event \"${event}\"`\n )\n }\n this.transformers[event].push({\n transformer,\n specifier,\n })\n }\n\n async initFormatter<OptionsType>(\n plugin: FormatterPlugin<OptionsType>,\n options: OptionsType,\n stream: NodeJS.WritableStream,\n write: (buffer: string | Uint8Array) => void,\n directory?: string,\n specifier?: string\n ) {\n const cleanupFn = await plugin.formatter({\n on: (key, handler) => this.registerHandler(key, handler, specifier),\n options: plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n stream,\n write,\n directory,\n })\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push({\n cleanupFn: cleanupFn,\n specifier,\n })\n }\n }\n\n async initCoordinatorExternal<OptionsType>(\n operation: PluginOperation,\n plugin: Plugin<OptionsType>,\n options: OptionsType,\n specifier?: string\n ) {\n const context = this.makeCoordinatorContext(\n operation,\n plugin,\n options,\n specifier\n )\n await this.initCoordinator(plugin, context, specifier)\n }\n\n async initCoordinatorInternal<OptionsType>(\n operation: PluginOperation,\n plugin: Plugin<OptionsType>,\n options: OptionsType\n ) {\n const context = {\n ...this.makeCoordinatorContext(operation, plugin, options),\n emit: this.emit.bind(this),\n }\n await this.initCoordinator(plugin, context)\n }\n\n private async initCoordinator<OptionsType>(\n plugin: Plugin<OptionsType>,\n context: CoordinatorContext<OptionsType>,\n specifier?: string\n ) {\n const cleanupFn = await wrapErrorAsync(\n async () => await plugin.coordinator(context),\n `${formatCulprit(specifier)} errored when trying to init`\n )\n if (typeof cleanupFn === 'function') {\n this.cleanupFns.push({\n cleanupFn: cleanupFn,\n specifier,\n })\n }\n }\n\n private makeCoordinatorContext<OptionsType>(\n operation: PluginOperation,\n plugin: Plugin<OptionsType> | InternalPlugin<OptionsType>,\n options: OptionsType,\n specifier?: string\n ) {\n return {\n operation,\n on: <K extends CoordinatorEventKey>(\n event: K,\n handler: CoordinatorEventHandler<K>\n ) => this.registerHandler(event, handler, specifier),\n transform: <K extends CoordinatorTransformKey>(\n event: K,\n transformer: CoordinatorTransformer<K>\n ) => this.registerTransformer(event, transformer, specifier),\n options:\n 'optionsKey' in plugin && plugin.optionsKey\n ? ((options as any)[plugin.optionsKey] ?? ({} as OptionsType))\n : options,\n logger: this.environment.logger,\n environment: {\n cwd: this.environment.cwd,\n stderr: this.environment.stderr,\n env: { ...this.environment.env },\n },\n }\n }\n\n emit<K extends CoordinatorEventKey>(\n event: K,\n value: CoordinatorEventValues[K]\n ): void {\n this.handlers[event].forEach(({ handler, specifier }) => {\n wrapError(\n () => handler(value),\n `${formatCulprit(specifier)} errored when trying to handle a \"${event}\" event`\n )\n })\n }\n\n async transform<K extends CoordinatorTransformKey>(\n event: K,\n value: CoordinatorTransformValues[K]\n ): Promise<CoordinatorTransformValues[K]> {\n let transformed = value\n for (const { transformer, specifier } of this.transformers[event]) {\n const returned = await wrapErrorAsync(\n async () => await transformer(transformed),\n `${formatCulprit(specifier)} errored when trying to do a \"${event}\" transform`\n )\n if (typeof returned !== 'undefined') {\n transformed = returned\n }\n }\n return transformed\n }\n\n async cleanup(): Promise<void> {\n for (const { cleanupFn, specifier } of this.cleanupFns) {\n await wrapErrorAsync(\n async () => await cleanupFn(),\n `${formatCulprit(specifier)} errored when trying to cleanup`\n )\n }\n }\n}\n\nfunction formatCulprit(specifier?: string) {\n return specifier ? `Plugin \"${specifier}\"` : 'Cucumber'\n}\n\nfunction wrapError<T>(fn: () => T, message: string): T {\n try {\n return fn()\n } catch (error) {\n throw new Error(message, { cause: error })\n }\n}\n\nasync function wrapErrorAsync<T>(\n fn: () => Promise<T>,\n message: string\n): Promise<T> {\n try {\n return await fn()\n } catch (error) {\n throw new Error(message, { cause: error })\n }\n}\n"]}
|
package/lib/plugin/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/plugin/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Writable } from 'node:stream'\nimport { Envelope } from '@cucumber/messages'\nimport { ILogger } from '../environment'\nimport { IFilterablePickle } from '../filter'\nimport { IResolvedPaths } from '../paths'\n\n/**\n * The operation Cucumber is doing in this process\n * @public\n * @remarks\n * `loadSources` and `loadSupport` are generally used as preflight operations\n * for complex use cases. `runCucumber` is the one where tests are actually\n * executed.\n */\nexport type PluginOperation = 'loadSources' | 'loadSupport' | 'runCucumber'\n\n/**\n * Subset of the environment available to plugins\n * @public\n */\nexport type CoordinatorEnvironment = {\n /**\n * Working directory for the project\n */\n cwd: string\n /**\n * Writable stream where the test run's warning/error output is written\n * and plugins can write to directly if required\n */\n stderr: Writable\n /**\n * Environment variables\n */\n env: Record<string, string | undefined>\n}\n\n/**\n * Keys for event handlers that plugins can register\n * @public\n */\nexport type CoordinatorEventKey = 'message' | 'paths:resolve' | 'publish:url'\n\n/**\n * Keys for transforms that plugins can register\n * @public\n */\nexport type CoordinatorTransformKey = 'pickles:filter' | 'pickles:order'\n\n/**\n * Mapping of event keys to their value types\n * @public\n */\nexport type CoordinatorEventValues = {\n message: Readonly<Envelope>\n 'paths:resolve': Readonly<IResolvedPaths>\n 'publish:url': string\n}\n\n/**\n * Mapping of transform keys to their value types\n * @public\n */\nexport type CoordinatorTransformValues = {\n 'pickles:filter': Readonly<Array<IFilterablePickle>>\n 'pickles:order': Readonly<Array<IFilterablePickle>>\n}\n\n/**\n * Handler function for a coordinator event\n * @public\n * @remarks\n * You can do async work here, but Cucumber will not await the Promise.\n */\nexport type CoordinatorEventHandler<K extends CoordinatorEventKey> = (\n value: CoordinatorEventValues[K]\n) => void\n\n/**\n * Transformer function for a coordinator transform\n * @remarks\n * Don't try to modify the original value. Return a transformed value, or\n * `undefined` to pass through unchanged.\n * @public\n */\nexport type CoordinatorTransformer<K extends CoordinatorTransformKey> = (\n value: CoordinatorTransformValues[K]\n) => PromiseLike<CoordinatorTransformValues[K]> | CoordinatorTransformValues[K]\n\n/**\n * Context object passed to a plugin's coordinator function\n * @public\n */\nexport type CoordinatorContext<OptionsType> = {\n /**\n * The operation Cucumber is doing in this process\n */\n operation: PluginOperation\n /**\n * Register an event handler\n */\n on: <EventKey extends CoordinatorEventKey>(\n event: EventKey,\n handler: CoordinatorEventHandler<EventKey>\n ) => void\n /**\n * Register a transformer\n */\n transform: <EventKey extends CoordinatorTransformKey>(\n event: EventKey,\n handler: CoordinatorTransformer<EventKey>\n ) => void\n /**\n * Options for the plugin\n */\n options: OptionsType\n /**\n * Logger for emitting user-facing messages or diagnostics\n */\n logger: ILogger\n /**\n * Subset of the environment\n */\n environment: CoordinatorEnvironment\n}\n\n/**\n * Optional cleanup function returned by a plugin coordinator\n * @public\n */\nexport type PluginCleanup = () => PromiseLike<void> | void\n\n/**\n * A plugin that can subscribe to events and register transforms\n * @public\n */\nexport type Plugin<OptionsType = any> = {\n type: 'plugin'\n /**\n * Coordinator function called during initialization\n * @remarks\n * Can do async work, and the Promise will be awaited. Can optionally return\n * a cleanup function to be called when Cucumber is about to exit.\n */\n coordinator: (\n context: CoordinatorContext<OptionsType>\n ) => PromiseLike<PluginCleanup | void> | PluginCleanup | void\n /**\n * Optional key to extract plugin-specific options from the root options object\n */\n optionsKey?: string\n}\n\n/**\n * Context object passed to an internal plugin's coordinator function\n * @internal\n */\nexport type InternalCoordinatorContext<OptionsType> =\n CoordinatorContext<OptionsType> & {\n emit: <EventKey extends CoordinatorEventKey>(\n event: EventKey,\n value: CoordinatorEventValues[EventKey]\n ) => void\n }\n\n/**\n * A built-in plugin with the additional ability to emit events\n * @internal\n */\nexport type InternalPlugin<OptionsType = any> = {\n type: 'plugin'\n coordinator: (\n context: InternalCoordinatorContext<OptionsType>\n ) => PromiseLike<PluginCleanup | void> | PluginCleanup | void\n}\n\nexport type FormatterPluginContext<OptionsType> = {\n on: (key: 'message', handler: (value: Envelope) => void) => void\n options: OptionsType\n logger: ILogger\n stream: NodeJS.WritableStream\n write: (buffer: string | Uint8Array) => void\n directory?: string\n}\n\nexport type FormatterPluginFunction<OptionsType> = (\n context: FormatterPluginContext<OptionsType>\n) => PromiseLike<PluginCleanup | void> | PluginCleanup | void\n\nexport type FormatterPlugin<OptionsType = any> = {\n type: 'formatter'\n formatter: FormatterPluginFunction<OptionsType>\n optionsKey?: string\n}\n"]}
|
package/lib/publish/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/publish/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAgD;AAEhD,kBAAe,8BAAa,CAAA;AAC5B,0CAAuB","sourcesContent":["import { publishPlugin } from './publish_plugin'\n\nexport default publishPlugin\nexport * from './types'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"publish_plugin.js","sourceRoot":"","sources":["../../src/publish/publish_plugin.ts"],"names":[],"mappings":";;;;;;AACA,mDAA+C;AAC/C,yCAAoD;AACpD,+CAAgD;AAChD,0DAA4B;AAC5B,qCAAgC;AAChC,qCAA6D;AAC7D,yCAAsC;AACtC,mDAA8C;AAC9C,wDAA8B;AAQ9B,MAAM,4BAA4B,GAAG,yCAAyC,CAAA;AAEjE,QAAA,aAAa,GAAmB;IAC3C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAChE,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,MAAM,EAAE,GAAG,GAAG,4BAA4B,EAAE,KAAK,EAAE,GAAG,OAAO,CAAA;QAC7D,MAAM,OAAO,GAA8B;YACzC,MAAM,EAAE,kBAAkB;SAC3B,CAAA;QACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,CAAC,aAAa,GAAG,UAAU,KAAK,EAAE,CAAA;QAC3C,CAAC;QACD,MAAM,aAAa,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAA;QAEnD,IAAI,aAAa,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;YAChC,OAAO,GAAG,EAAE;gBACV,MAAM,CAAC,KAAK,CACV,+BAA+B,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,gBAChD,aAAa,CAAC,MAChB,E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tC,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import { Writable } from 'node:stream'\nimport { pipeline } from 'node:stream/promises'\nimport { stripVTControlCharacters } from 'node:util'\nimport { mkdtemp, stat } from 'node:fs/promises'\nimport path from 'node:path'\nimport { tmpdir } from 'node:os'\nimport { createReadStream, createWriteStream } from 'node:fs'\nimport { createGzip } from 'node:zlib'\nimport { supportsColor } from 'supports-color'\nimport hasAnsi from 'has-ansi'\nimport { InternalPlugin } from '../plugin'\n\ntype TouchResult = {\n banner: string\n url?: string\n}\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://reports.cucumber.io/api/reports'\n\nexport const publishPlugin: InternalPlugin = {\n type: 'plugin',\n coordinator: async ({ on, emit, logger, options, environment }) => {\n if (!options) {\n return undefined\n }\n const { url = DEFAULT_CUCUMBER_PUBLISH_URL, token } = options\n const headers: { [key: string]: string } = {\n Accept: 'application/json',\n }\n if (token !== undefined) {\n headers.Authorization = `Bearer ${token}`\n }\n const touchResponse = await fetch(url, { headers })\n\n if (touchResponse.status >= 500) {\n return () => {\n logger.error(\n `Failed to publish report to ${new URL(url).origin} with status ${\n touchResponse.status\n }`\n )\n logger.debug(touchResponse)\n }\n }\n\n const touchResult = (await touchResponse.json()) as TouchResult\n\n if (!touchResponse.ok) {\n return () => {\n environment.stderr.write(\n sanitisePublishOutput(touchResult.banner, environment.stderr) + '\\n'\n )\n }\n }\n\n if (touchResult.url) {\n emit('publish:url', touchResult.url)\n }\n\n const uploadUrl = touchResponse.headers.get('Location')\n const tempDir = await mkdtemp(path.join(tmpdir(), `cucumber-js-publish-`))\n const tempFilePath = path.join(tempDir, 'envelopes.jsonl.gz')\n const writeStream = createGzip()\n const finishedWriting = pipeline(\n writeStream,\n createWriteStream(tempFilePath)\n )\n on('message', (value) => writeStream.write(JSON.stringify(value) + '\\n'))\n\n return () => {\n return new Promise<void>((resolve) => {\n writeStream.end(async () => {\n await finishedWriting\n const stats = await stat(tempFilePath)\n const contentLength = stats.size.toString()\n logger.debug(\n 'Uploading envelopes to Cucumber Reports with content length:',\n contentLength\n )\n const uploadResponse = await fetch(uploadUrl, {\n method: 'PUT',\n headers: {\n 'Content-Type': 'application/jsonl',\n 'Content-Encoding': 'gzip',\n 'Content-Length': contentLength,\n },\n body: createReadStream(tempFilePath),\n duplex: 'half',\n })\n if (uploadResponse.ok) {\n environment.stderr.write(\n sanitisePublishOutput(touchResult.banner, environment.stderr) +\n '\\n'\n )\n } else {\n logger.error(\n `Failed to upload report to ${\n new URL(uploadUrl).origin\n } with status ${uploadResponse.status}`\n )\n logger.debug(await uploadResponse.text())\n }\n resolve()\n })\n })\n }\n },\n}\n\n/*\nThis is because the Cucumber Reports service returns a pre-formatted console message\nincluding ANSI escapes, so if our stderr stream doesn't support those we need to\nstrip them back out. Ideally we should get structured data from the service and\ncompose the console message on this end.\n */\nfunction sanitisePublishOutput(raw: string, stderr: Writable) {\n if (!supportsColor(stderr) && hasAnsi(raw)) {\n return stripVTControlCharacters(raw)\n }\n return raw\n}\n"]}
|
package/lib/publish/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/publish/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Options relating to publication to https://reports.cucumber.io\n * @public\n */\nexport interface IPublishConfig {\n /**\n * Base URL for the Cucumber Reports service\n */\n url: string\n /**\n * Access token for the Cucumber Reports service\n */\n token: string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/attachment_manager/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0DAAgC;AAChC,6DAA8C;AAC9C,uDAAqE;AA2CrE,MAAqB,iBAAiB;IACnB,YAAY,CAAiB;IAE9C,YAAY,YAA6B;QACvC,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IAClC,CAA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;gBACxE,OAAO,EAAE,CAAA;YACX,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC1B,CAAC,CAAC,CAAA;QACF,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAClC,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAA;QAChB,CAAC;IACH,CAAC;IAED,sBAAsB,CACpB,IAAY,EACZ,KAAuB,EACvB,QAAiB;QAEjB,IAAI,CAAC,YAAY,CAAC;YAChB,IAAI;YACJ,KAAK;YACL,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClC,CAAC,CAAA;IACJ,CAAC;CACF;AApHD,oCAoHC;AAED,SAAS,gBAAgB,CACvB,kBAAsD;IAEtD,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,IAAI,OAAO,kBAAkB,KAAK,QAAQ,EAAE,CAAC;QAC3C,OAAO;YACL,SAAS,EAAE,kBAAkB;SAC9B,CAAA;IACH,CAAC;IACD,OAAO,kBAAkB,CAAA;AAC3B,CAAC","sourcesContent":["import { Readable } from 'node:stream'\nimport isStream from 'is-stream'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, doesNotHaveValue } from '../../value_checker'\n\nexport interface IAttachmentMedia {\n encoding: messages.AttachmentContentEncoding\n contentType: string\n}\n\nexport interface IAttachment {\n data: string\n media: IAttachmentMedia\n fileName?: string\n}\n\nexport type IAttachFunction = (attachment: IAttachment) => void\n\nexport interface ICreateAttachmentOptions {\n mediaType: string\n fileName?: string\n}\nexport type ICreateStringAttachment = (\n data: string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n) => void\nexport type ICreateBufferAttachment = (\n data: Buffer,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => void\nexport type ICreateStreamAttachment = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions\n) => Promise<void>\nexport type ICreateStreamAttachmentWithCallback = (\n data: Readable,\n mediaTypeOrOptions: string | ICreateAttachmentOptions,\n callback: () => void\n) => void\nexport type ICreateAttachment = ICreateStringAttachment &\n ICreateBufferAttachment &\n ICreateStreamAttachment &\n ICreateStreamAttachmentWithCallback\nexport type ICreateLog = (text: string) => void\nexport type ICreateLink = (text: string) => void\n\nexport default class AttachmentManager {\n private readonly onAttachment: IAttachFunction\n\n constructor(onAttachment: IAttachFunction) {\n this.onAttachment = onAttachment\n }\n\n log(text: string): void | Promise<void> {\n return this.create(text, 'text/x.cucumber.log+plain')\n }\n\n link(...url: string[]): void | Promise<void> {\n return this.create(url.join('\\n'), 'text/uri-list')\n }\n\n create(\n data: Buffer | Readable | string,\n mediaTypeOrOptions?: string | ICreateAttachmentOptions,\n callback?: () => void\n ): void | Promise<void> {\n const options = normaliseOptions(mediaTypeOrOptions)\n if (Buffer.isBuffer(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Buffer attachments must specify a media type')\n }\n this.createBufferAttachment(data, options.mediaType, options.fileName)\n } else if (isStream.readable(data)) {\n if (doesNotHaveValue(options.mediaType)) {\n throw Error('Stream attachments must specify a media type')\n }\n return this.createStreamAttachment(\n data,\n options.mediaType,\n options.fileName,\n callback\n )\n } else if (typeof data === 'string') {\n if (doesNotHaveValue(options.mediaType)) {\n options.mediaType = 'text/plain'\n }\n if (options.mediaType.startsWith('base64:')) {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: options.mediaType.replace('base64:', ''),\n },\n options.fileName\n )\n } else {\n this.createStringAttachment(\n data,\n {\n encoding: messages.AttachmentContentEncoding.IDENTITY,\n contentType: options.mediaType,\n },\n options.fileName\n )\n }\n } else {\n throw Error(\n 'Invalid attachment data: must be a buffer, readable stream, or string'\n )\n }\n }\n\n createBufferAttachment(\n data: Buffer,\n mediaType: string,\n fileName?: string\n ): void {\n this.createStringAttachment(\n data.toString('base64'),\n {\n encoding: messages.AttachmentContentEncoding.BASE64,\n contentType: mediaType,\n },\n fileName\n )\n }\n\n createStreamAttachment(\n data: Readable,\n mediaType: string,\n fileName?: string,\n callback?: () => void\n ): void | Promise<void> {\n const promise = new Promise<void>((resolve, reject) => {\n const buffers: Uint8Array[] = []\n data.on('data', (chunk) => {\n buffers.push(chunk)\n })\n data.on('end', () => {\n this.createBufferAttachment(Buffer.concat(buffers), mediaType, fileName)\n resolve()\n })\n data.on('error', reject)\n })\n if (doesHaveValue(callback)) {\n promise.then(callback, callback)\n } else {\n return promise\n }\n }\n\n createStringAttachment(\n data: string,\n media: IAttachmentMedia,\n fileName?: string\n ): void {\n this.onAttachment({\n data,\n media,\n ...(fileName ? { fileName } : {}),\n })\n }\n}\n\nfunction normaliseOptions(\n mediaTypeOrOptions?: string | ICreateAttachmentOptions\n): Partial<ICreateAttachmentOptions> {\n if (!mediaTypeOrOptions) {\n return {}\n }\n if (typeof mediaTypeOrOptions === 'string') {\n return {\n mediaType: mediaTypeOrOptions,\n }\n }\n return mediaTypeOrOptions\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/runtime/coordinator.ts"],"names":[],"mappings":";;;AAEA,0CAA8D;AAG9D,2CAAuC;AAGvC,MAAa,WAAW;IAEZ;IACA;IACA;IACA;IACA;IACA;IANV,YACU,gBAAwB,EACxB,gBAA8B,EAC9B,KAAwB,EACxB,cAA4C,EAC5C,kBAAsC,EACtC,OAAuB;QALvB,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,mBAAc,GAAd,cAAc,CAA8B;QAC5C,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,YAAO,GAAP,OAAO,CAAgB;IAC9B,CAAC;IAEJ,KAAK,CAAC,GAAG;QACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,cAAc,EAAE;gBACd,EAAE,EAAE,IAAI,CAAC,gBAAgB;gBACzB,SAAS,EAAE,IAAA,qBAAS,GAAE;aACvB;SACiB,CAAC,CAAA;QAErB,MAAM,kBAAkB,GAAG,MAAM,IAAA,4BAAiB,EAChD,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,kBAAkB,CACxB,CAAA;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAA;QAE1D,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,eAAe,EAAE;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,SAAS,EAAE,IAAA,qBAAS,GAAE;gBACtB,OAAO;aACR;SACiB,CAAC,CAAA;QAErB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAtCD,kCAsCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { Envelope, IdGenerator } from '@cucumber/messages'\nimport { assembleTestCases, SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport { RuntimeAdapter } from './types'\nimport { timestamp } from './stopwatch'\nimport { Runtime } from './index'\n\nexport class Coordinator implements Runtime {\n constructor(\n private testRunStartedId: string,\n private eventBroadcaster: EventEmitter,\n private newId: IdGenerator.NewId,\n private sourcedPickles: ReadonlyArray<SourcedPickle>,\n private supportCodeLibrary: SupportCodeLibrary,\n private adapter: RuntimeAdapter\n ) {}\n\n async run(): Promise<boolean> {\n this.eventBroadcaster.emit('envelope', {\n testRunStarted: {\n id: this.testRunStartedId,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n const assembledTestCases = await assembleTestCases(\n this.testRunStartedId,\n this.eventBroadcaster,\n this.newId,\n this.sourcedPickles,\n this.supportCodeLibrary\n )\n\n const success = await this.adapter.run(assembledTestCases)\n\n this.eventBroadcaster.emit('envelope', {\n testRunFinished: {\n testRunStartedId: this.testRunStartedId,\n timestamp: timestamp(),\n success,\n },\n } satisfies Envelope)\n\n return success\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"format_error.js","sourceRoot":"","sources":["../../src/runtime/format_error.ts"],"names":[],"mappings":";;;;;AAKA,kCA0CC;AA9CD,yEAAkD;AAClD,4EAAiD;AACjD,8DAAwD;AAExD,SAAgB,WAAW,CACzB,KAAqB,EACrB,iBAA0B;IAE1B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,UAAU,KAAK,EAAE,CAAA;QACpC,OAAO;YACL,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,KAAK;gBACd,UAAU;aACX;SACF,CAAA;IACH,CAAC;IACD,IAAI,mBAAmB,GAAW,KAAK,CAAC,KAAK,CAAA;IAC7C,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,4BAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACjD,MAAM,aAAa,GAAG,iBAAiB;YACrC,CAAC,CAAC,IAAA,qCAAgB,EAAC,WAAW,CAAC;YAC/B,CAAC,CAAC,WAAW,CAAA;QACf,mBAAmB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;IAC3E,CAAC;IACD,MAAM,UAAU,GAAG,IAAA,kCAAM,EAAC,KAAK,EAAE;QAC/B,QAAQ,EAAE;YACR,UAAU,EAAE,CAAC,KAAa,EAAE,EAAE;gBAC5B,OAAO,mBAAmB,CAAC,CAAC,CAAC,KAAK,mBAAmB,EAAE,CAAC,CAAC,CAAC,KAAK,CAAA;YACjE,CAAC;SACF;KACF,CAAC,CAAA;IACF,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,MAAM,OAAO,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;IACjE,OAAO;QACL,OAAO,EAAE,UAAU;QACnB,SAAS,EAAE;YACT,IAAI;YACJ,OAAO;YACP,UAAU;SACX;KACF,CAAA;AACH,CAAC","sourcesContent":["import { TestStepResult } from '@cucumber/messages'\nimport { format } from 'assertion-error-formatter'\nimport errorStackParser from 'error-stack-parser'\nimport { filterStackTrace } from '../filter_stack_trace'\n\nexport function formatError(\n error: Error | string,\n filterStackTraces: boolean\n): Pick<TestStepResult, 'message' | 'exception'> {\n if (typeof error === 'string') {\n const stackTrace = `Error: ${error}`\n return {\n message: stackTrace,\n exception: {\n type: 'Error',\n message: error,\n stackTrace,\n },\n }\n }\n let processedStackTrace: string = error.stack\n try {\n const parsedStack = errorStackParser.parse(error)\n const filteredStack = filterStackTraces\n ? filterStackTrace(parsedStack)\n : parsedStack\n processedStackTrace = filteredStack.map((f) => f.source).join('\\n')\n } catch {\n // if we weren't able to parse and process, we'll settle for the original\n }\n const stackTrace = format(error, {\n colorFns: {\n errorStack: (stack: string) => {\n return processedStackTrace ? `\\n${processedStackTrace}` : stack\n },\n },\n })\n const type = error.constructor.name\n const message = typeof error === 'string' ? error : error.message\n return {\n message: stackTrace,\n exception: {\n type,\n message,\n stackTrace,\n },\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/runtime/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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,CAAC,KAAK,CAAA;IAC7B,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,CAAC,CAAA;IACV,CAAC;IACD,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,CAAA;IAC7C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,MAAM,eAAe,GAAG,IAAI,+BAAe,CAAC,cAAc,CAAC,CAAA;IAC3D,IAAI,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,EAAE,CAAC;QACrD,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC;AAED,SAAgB,kBAAkB,CAChC,MAAqC,EACrC,OAAuB;IAEvB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,KAAK,CAAA;IACd,CAAC;IACD,MAAM,eAAe,GAAoC;QACvD,QAAQ,CAAC,oBAAoB,CAAC,SAAS;QACvC,QAAQ,CAAC,oBAAoB,CAAC,MAAM;QACpC,QAAQ,CAAC,oBAAoB,CAAC,SAAS;KACxC,CAAA;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;AACzC,CAAC","sourcesContent":["import Table from 'cli-table3'\nimport indentString from 'indent-string'\nimport * as messages from '@cucumber/messages'\nimport { formatLocation } from '../formatter/helpers/location_helpers'\nimport { PickleTagFilter } from '../pickle_filter'\nimport StepDefinition from '../models/step_definition'\nimport { RuntimeOptions } from '.'\n\nexport function getAmbiguousStepException(\n stepDefinitions: StepDefinition[]\n): string {\n const table = new Table({\n chars: {\n bottom: '',\n 'bottom-left': '',\n 'bottom-mid': '',\n 'bottom-right': '',\n left: '',\n 'left-mid': '',\n mid: '',\n 'mid-mid': '',\n middle: ' - ',\n right: '',\n 'right-mid': '',\n top: '',\n 'top-left': '',\n 'top-mid': '',\n 'top-right': '',\n },\n style: {\n border: [],\n 'padding-left': 0,\n 'padding-right': 0,\n },\n })\n table.push(\n ...stepDefinitions.map((stepDefinition) => {\n const pattern = stepDefinition.pattern.toString()\n return [pattern, formatLocation(stepDefinition)]\n })\n )\n return `${'Multiple step definitions match:' + '\\n'}${indentString(\n table.toString(),\n 2\n )}`\n}\n\nexport function retriesForPickle(\n pickle: messages.Pickle,\n options: RuntimeOptions\n): number {\n if (!options.retry) {\n return 0\n }\n const retries = options.retry\n if (retries === 0) {\n return 0\n }\n const retryTagFilter = options.retryTagFilter\n if (!retryTagFilter) {\n return retries\n }\n const pickleTagFilter = new PickleTagFilter(retryTagFilter)\n if (pickleTagFilter.matchesAllTagExpressions(pickle)) {\n return retries\n }\n return 0\n}\n\nexport function shouldCauseFailure(\n status: messages.TestStepResultStatus,\n options: RuntimeOptions\n): boolean {\n if (options.dryRun) {\n return false\n }\n const failureStatuses: messages.TestStepResultStatus[] = [\n messages.TestStepResultStatus.AMBIGUOUS,\n messages.TestStepResultStatus.FAILED,\n messages.TestStepResultStatus.UNDEFINED,\n ]\n if (options.strict) {\n failureStatuses.push(messages.TestStepResultStatus.PENDING)\n }\n return failureStatuses.includes(status)\n}\n"]}
|
package/lib/runtime/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/runtime/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA8B","sourcesContent":["export * from './make_runtime'\nexport { Runtime, RuntimeOptions } from './types'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make_runtime.js","sourceRoot":"","sources":["../../src/runtime/make_runtime.ts"],"names":[],"mappings":";;;;;AAaA,kCAsCC;AA7CD,mEAAmD;AAGnD,gDAAwD;AACxD,8CAAmD;AACnD,+CAA2C;AAEpC,KAAK,UAAU,WAAW,CAAC,EAChC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,cAAc,EACd,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,cAAc,GAUf;IACC,MAAM,gBAAgB,GAAG,KAAK,EAAE,CAAA;IAChC,MAAM,OAAO,GAAG,MAAM,WAAW,CAC/B,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,CACN,CAAA;IACD,OAAO,IAAI,yBAAW,CACpB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,cAAc,EACd,kBAAkB,EAClB,OAAO,CACR,CAAA;AACH,CAAC;AAED,KAAK,UAAU,WAAW,CACxB,OAA2B,EAC3B,cAAyE,EACzE,gBAAwB,EACxB,WAA4B,EAC5B,MAAe,EACf,gBAA8B,EAC9B,kBAAsC,EACtC,KAAmB;IAEnB,IAAI,OAAO,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,6BAAmB,CAC5B,gBAAgB,EAChB,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,kBAAkB,CACnB,CAAA;IACH,CAAC;IACD,MAAM,cAAc,GAAG,MAAM,iBAAgB,CAAC,+BAA+B,CAC3E;QACE,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,gBAAgB,EAAE,cAAc,CAAC,gBAAgB;QACjD,aAAa,EAAE,cAAc,CAAC,aAAa;QAC3C,kBAAkB;KACnB,CACF,CAAA;IACD,OAAO,IAAI,0BAAgB,CACzB,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,EAClB,cAAc,CACf,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport { IRunOptionsRuntime } from '../api'\nimport { ILogger, IRunEnvironment } from '../environment'\nimport { SourcedPickle } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport FormatterBuilder from '../formatter/builder'\nimport { FormatOptions } from '../formatter'\nimport { Runtime } from './types'\nimport { ChildProcessAdapter } from './parallel/adapter'\nimport { InProcessAdapter } from './serial/adapter'\nimport { Coordinator } from './coordinator'\n\nexport async function makeRuntime({\n environment,\n logger,\n eventBroadcaster,\n sourcedPickles,\n newId,\n supportCodeLibrary,\n options,\n snippetOptions,\n}: {\n environment: IRunEnvironment\n logger: ILogger\n eventBroadcaster: EventEmitter\n newId: IdGenerator.NewId\n sourcedPickles: ReadonlyArray<SourcedPickle>\n supportCodeLibrary: SupportCodeLibrary\n options: IRunOptionsRuntime\n snippetOptions: Pick<FormatOptions, 'snippetInterface' | 'snippetSyntax'>\n}): Promise<Runtime> {\n const testRunStartedId = newId()\n const adapter = await makeAdapter(\n options,\n snippetOptions,\n testRunStartedId,\n environment,\n logger,\n eventBroadcaster,\n supportCodeLibrary,\n newId\n )\n return new Coordinator(\n testRunStartedId,\n eventBroadcaster,\n newId,\n sourcedPickles,\n supportCodeLibrary,\n adapter\n )\n}\n\nasync function makeAdapter(\n options: IRunOptionsRuntime,\n snippetOptions: Pick<FormatOptions, 'snippetInterface' | 'snippetSyntax'>,\n testRunStartedId: string,\n environment: IRunEnvironment,\n logger: ILogger,\n eventBroadcaster: EventEmitter,\n supportCodeLibrary: SupportCodeLibrary,\n newId: () => string\n) {\n if (options.parallel > 0) {\n return new ChildProcessAdapter(\n testRunStartedId,\n environment,\n logger,\n eventBroadcaster,\n options,\n snippetOptions,\n supportCodeLibrary\n )\n }\n const snippetBuilder = await FormatterBuilder.getStepDefinitionSnippetBuilder(\n {\n cwd: environment.cwd,\n snippetInterface: snippetOptions.snippetInterface,\n snippetSyntax: snippetOptions.snippetSyntax,\n supportCodeLibrary,\n }\n )\n return new InProcessAdapter(\n testRunStartedId,\n eventBroadcaster,\n newId,\n options,\n supportCodeLibrary,\n snippetBuilder\n )\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make_suggestion.js","sourceRoot":"","sources":["../../src/runtime/make_suggestion.ts"],"names":[],"mappings":";;AAsBA,wCAqBC;AA3CD,iDAK2B;AAE3B,kDAAkD;AAElD,SAAS,8BAA8B,CAAC,IAAqB;IAC3D,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,yBAAc,CAAC,OAAO;YACzB,OAAO,qBAAW,CAAC,YAAY,CAAA;QACjC,KAAK,yBAAc,CAAC,MAAM;YACxB,OAAO,qBAAW,CAAC,KAAK,CAAA;QAC1B,KAAK,yBAAc,CAAC,OAAO;YACzB,OAAO,qBAAW,CAAC,OAAO,CAAA;QAC5B;YACE,OAAO,qBAAW,CAAC,YAAY,CAAA;IACnC,CAAC;AACH,CAAC;AAED,SAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,cAAc,EACd,UAAU,GAKX;IACC,MAAM,WAAW,GAAG,8BAA8B,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;IACnE,MAAM,KAAK,GAAG,cAAc,CAAC,aAAa,CAAC,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAA;IACvE,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI;QACJ,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC,CAAA;IAEH,OAAO;QACL,EAAE,EAAE,KAAK,EAAE;QACX,YAAY,EAAE,UAAU,CAAC,EAAE;QAC3B,QAAQ;KACT,CAAA;AACH,CAAC","sourcesContent":["import {\n IdGenerator,\n PickleStep,\n PickleStepType,\n Suggestion,\n} from '@cucumber/messages'\nimport StepDefinitionSnippetBuilder from '../formatter/step_definition_snippet_builder'\nimport { KeywordType } from '../formatter/helpers'\n\nfunction mapPickleStepTypeToKeywordType(type?: PickleStepType): KeywordType {\n switch (type) {\n case PickleStepType.CONTEXT:\n return KeywordType.Precondition\n case PickleStepType.ACTION:\n return KeywordType.Event\n case PickleStepType.OUTCOME:\n return KeywordType.Outcome\n default:\n return KeywordType.Precondition\n }\n}\n\nexport function makeSuggestion({\n newId,\n snippetBuilder,\n pickleStep,\n}: {\n newId: IdGenerator.NewId\n snippetBuilder: StepDefinitionSnippetBuilder\n pickleStep: PickleStep\n}): Suggestion {\n const keywordType = mapPickleStepTypeToKeywordType(pickleStep.type)\n const codes = snippetBuilder.buildMultiple({ keywordType, pickleStep })\n const snippets = codes.map((code) => ({\n code,\n language: 'javascript',\n }))\n\n return {\n id: newId(),\n pickleStepId: pickleStep.id,\n snippets,\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/runtime/parallel/adapter.ts"],"names":[],"mappings":";;;;;;AAAA,2DAAuD;AACvD,0DAA4B;AAe5B,MAAM,aAAa,GAAG,mBAAI,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,CAAC,CAAA;AAoB9D,MAAa,mBAAmB;IASX;IACA;IACA;IACA;IACA;IACA;IAIA;IAjBX,iBAAiB,GAAW,CAAC,CAAA;IAC7B,OAAO,GAAY,KAAK,CAAA;IACxB,QAAQ,CAA4B;IACpC,IAAI,GAA6B,EAAE,CAAA;IAC1B,UAAU,GAAsC,EAAE,CAAA;IAClD,OAAO,GAAkC,EAAE,CAAA;IAE5D,YACmB,gBAAwB,EACxB,WAA4B,EAC5B,MAAe,EACf,gBAA8B,EAC9B,OAA2B,EAC3B,cAGhB,EACgB,kBAAsC;QATtC,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,gBAAW,GAAX,WAAW,CAAiB;QAC5B,WAAM,GAAN,MAAM,CAAS;QACf,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,YAAO,GAAP,OAAO,CAAoB;QAC3B,mBAAc,GAAd,cAAc,CAG9B;QACgB,uBAAkB,GAAlB,kBAAkB,CAAoB;IACtD,CAAC;IAEJ,kBAAkB,CAChB,MAAqB,EACrB,OAAiC;QAEjC,Q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B,MAAM,CAAC,KAAK,8BAAsB,CAAA;YAClC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAA4B,CAAC,CAAA;YACnE,OAAM;QACR,CAAC;QAED,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAA;QAE5E,IAAI,aAAa,KAAK,IAAI,EAAE,CAAC;YAC3B,OAAM;QACR,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,aAAa,CAAA;QAEhD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,CAAA;QAC9B,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,IAAI,CAAA;QACjC,MAAM,CAAC,KAAK,8BAAsB,CAAA;QAClC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC;YAClB,IAAI,EAAE,KAAK;YACX,iBAAiB,EAAE,IAAI;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;SACD,CAAC,CAAA;IACzB,CAAC;CACF;AAzLD,kDAyLC","sourcesContent":["import { ChildProcess, fork } from 'node:child_process'\nimport path from 'node:path'\nimport { EventEmitter } from 'node:events'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport { AssembledTestCase } from '../../assemble'\nimport { ILogger, IRunEnvironment } from '../../environment'\nimport { RuntimeAdapter } from '../types'\nimport { IRunOptionsRuntime } from '../../api'\nimport { FormatOptions } from '../../formatter'\nimport {\n FinalizeCommand,\n InitializeCommand,\n RunCommand,\n WorkerToCoordinatorEvent,\n} from './types'\n\nconst runWorkerPath = path.resolve(__dirname, 'run_worker.js')\n\nconst enum WorkerState {\n 'idle',\n 'closed',\n 'running',\n 'new',\n}\n\ninterface ManagedWorker {\n state: WorkerState\n process: ChildProcess\n id: string\n}\n\ninterface WorkPlacement {\n index: number\n item: AssembledTestCase\n}\n\nexport class ChildProcessAdapter implements RuntimeAdapter {\n private idleInterventions: number = 0\n private failing: boolean = false\n private onFinish: (success: boolean) => void\n private todo: Array<AssembledTestCase> = []\n private readonly inProgress: Record<string, AssembledTestCase> = {}\n private readonly workers: Record<string, ManagedWorker> = {}\n\n constructor(\n private readonly testRunStartedId: string,\n private readonly environment: IRunEnvironment,\n private readonly logger: ILogger,\n private readonly eventBroadcaster: EventEmitter,\n private readonly options: IRunOptionsRuntime,\n private readonly snippetOptions: Pick<\n FormatOptions,\n 'snippetInterface' | 'snippetSyntax'\n >,\n private readonly supportCodeLibrary: SupportCodeLibrary\n ) {}\n\n parseWorkerMessage(\n worker: ManagedWorker,\n message: WorkerToCoordinatorEvent\n ): void {\n switch (message.type) {\n case 'READY':\n worker.state = WorkerState.idle\n this.awakenWorkers(worker)\n break\n case 'ENVELOPE':\n this.eventBroadcaster.emit('envelope', message.envelope)\n break\n case 'FINISHED':\n if (!message.success) {\n this.failing = true\n }\n delete this.inProgress[worker.id]\n worker.state = WorkerState.idle\n this.awakenWorkers(worker)\n break\n default:\n throw new Error(\n `Unexpected message from worker: ${JSON.stringify(message)}`\n )\n }\n }\n\n awakenWorkers(triggeringWorker: ManagedWorker): void {\n Object.values(this.workers).forEach((worker) => {\n if (worker.state === WorkerState.idle) {\n this.giveWork(worker)\n }\n return worker.state !== WorkerState.idle\n })\n\n if (Object.keys(this.inProgress).length == 0 && this.todo.length > 0) {\n this.giveWork(triggeringWorker, true)\n this.idleInterventions++\n }\n }\n\n startWorker(id: string, total: number): void {\n const workerProcess = fork(runWorkerPath, [], {\n cwd: this.environment.cwd,\n env: {\n ...this.environment.env,\n CUCUMBER_PARALLEL: 'true',\n CUCUMBER_TOTAL_WORKERS: total.toString(),\n CUCUMBER_WORKER_ID: id,\n },\n stdio: ['inherit', 'inherit', 'inherit', 'ipc'],\n })\n const worker = { state: WorkerState.new, process: workerProcess, id }\n this.workers[id] = worker\n worker.process.on('message', (message: WorkerToCoordinatorEvent) => {\n this.parseWorkerMessage(worker, message)\n })\n worker.process.on('close', (exitCode) => {\n worker.state = WorkerState.closed\n this.onWorkerProcessClose(exitCode)\n })\n worker.process.send({\n type: 'INITIALIZE',\n testRunStartedId: this.testRunStartedId,\n supportCodeCoordinates: this.supportCodeLibrary.originalCoordinates,\n supportCodeIds: {\n stepDefinitionIds: this.supportCodeLibrary.stepDefinitions.map(\n (s) => s.id\n ),\n beforeTestCaseHookDefinitionIds:\n this.supportCodeLibrary.beforeTestCaseHookDefinitions.map(\n (h) => h.id\n ),\n afterTestCaseHookDefinitionIds:\n this.supportCodeLibrary.afterTestCaseHookDefinitions.map((h) => h.id),\n beforeTestRunHookDefinitionIds:\n this.supportCodeLibrary.beforeTestRunHookDefinitions.map((h) => h.id),\n afterTestRunHookDefinitionIds:\n this.supportCodeLibrary.afterTestRunHookDefinitions.map((h) => h.id),\n },\n options: this.options,\n snippetOptions: this.snippetOptions,\n } satisfies InitializeCommand)\n }\n\n onWorkerProcessClose(exitCode: number): void {\n if (exitCode !== 0) {\n this.failing = true\n }\n\n if (\n Object.values(this.workers).every((x) => x.state === WorkerState.closed)\n ) {\n this.onFinish(!this.failing)\n }\n }\n\n async run(\n assembledTestCases: ReadonlyArray<AssembledTestCase>\n ): Promise<boolean> {\n this.todo = Array.from(assembledTestCases)\n return await new Promise<boolean>((resolve) => {\n for (let i = 0; i < this.options.parallel; i++) {\n this.startWorker(i.toString(), this.options.parallel)\n }\n this.onFinish = (status) => {\n if (this.idleInterventions > 0) {\n this.logger.warn(\n `WARNING: All workers went idle ${this.idleInterventions} time(s). Consider revising handler passed to setParallelCanAssign.`\n )\n }\n\n resolve(status)\n }\n })\n }\n\n nextWorkPlacement(): WorkPlacement {\n for (let index = 0; index < this.todo.length; index++) {\n const placement = this.placementAt(index)\n if (\n this.supportCodeLibrary.parallelCanAssign(\n placement.item.pickle,\n Object.values(this.inProgress).map(({ pickle }) => pickle)\n )\n ) {\n return placement\n }\n }\n\n return null\n }\n\n placementAt(index: number): WorkPlacement {\n return {\n index,\n item: this.todo[index],\n }\n }\n\n giveWork(worker: ManagedWorker, force: boolean = false): void {\n if (this.todo.length < 1) {\n worker.state = WorkerState.running\n worker.process.send({ type: 'FINALIZE' } satisfies FinalizeCommand)\n return\n }\n\n const workPlacement = force ? this.placementAt(0) : this.nextWorkPlacement()\n\n if (workPlacement === null) {\n return\n }\n\n const { index: nextIndex, item } = workPlacement\n\n this.todo.splice(nextIndex, 1)\n this.inProgress[worker.id] = item\n worker.state = WorkerState.running\n worker.process.send({\n type: 'RUN',\n assembledTestCase: item,\n failing: this.failing,\n } satisfies RunCommand)\n }\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const value_checker_1 = require("../../value_checker");
|
|
4
|
-
const worker_1 = require("./worker");
|
|
5
|
-
function run() {
|
|
6
|
-
const exit = (exitCode, error, message) => {
|
|
7
|
-
if ((0, value_checker_1.doesHaveValue)(error)) {
|
|
8
|
-
console.error(new Error(message, { cause: error })); // eslint-disable-line no-console
|
|
9
|
-
}
|
|
10
|
-
process.exit(exitCode);
|
|
11
|
-
};
|
|
12
|
-
const worker = new worker_1.ChildProcessWorker({
|
|
13
|
-
id: process.env.CUCUMBER_WORKER_ID,
|
|
14
|
-
sendMessage: (message) => process.send(message),
|
|
15
|
-
cwd: process.cwd(),
|
|
16
|
-
exit,
|
|
17
|
-
});
|
|
18
|
-
process.on('message', (m) => {
|
|
19
|
-
worker
|
|
20
|
-
.receiveMessage(m)
|
|
21
|
-
.catch((error) => exit(1, error, 'Unexpected error on worker.receiveMessage'));
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
run();
|
|
25
|
-
//# sourceMappingURL=run_worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run_worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/run_worker.ts"],"names":[],"mappings":";;AAAA,uDAAmD;AACnD,qCAA6C;AAE7C,SAAS,GAAG;IACV,MAAM,IAAI,GAAG,CAAC,QAAgB,EAAE,KAAa,EAAE,OAAgB,EAAQ,EAAE;QACvE,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAA,CAAC,iCAAiC;QACvF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACxB,CAAC,CAAA;IACD,MAAM,MAAM,GAAG,IAAI,2BAAkB,CAAC;QACpC,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 { doesHaveValue } from '../../value_checker'\nimport { ChildProcessWorker } from './worker'\n\nfunction run(): void {\n const exit = (exitCode: number, error?: Error, message?: string): void => {\n if (doesHaveValue(error)) {\n console.error(new Error(message, { cause: error })) // eslint-disable-line no-console\n }\n process.exit(exitCode)\n }\n const worker = new ChildProcessWorker({\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/runtime/parallel/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Envelope } from '@cucumber/messages'\nimport { RuntimeOptions } from '../index'\nimport { ISupportCodeCoordinates } from '../../api'\nimport { AssembledTestCase } from '../../assemble'\nimport { CanonicalSupportCodeIds } from '../../support_code_library_builder/types'\nimport { FormatOptions } from '../../formatter'\n\n// Messages from Coordinator to Worker\n\nexport type CoordinatorToWorkerCommand =\n | InitializeCommand\n | RunCommand\n | FinalizeCommand\n\nexport interface InitializeCommand {\n type: 'INITIALIZE'\n testRunStartedId: string\n supportCodeCoordinates: ISupportCodeCoordinates\n supportCodeIds: CanonicalSupportCodeIds\n options: RuntimeOptions\n snippetOptions: Pick<FormatOptions, 'snippetInterface' | 'snippetSyntax'>\n}\n\nexport interface RunCommand {\n type: 'RUN'\n assembledTestCase: AssembledTestCase\n failing: boolean\n}\n\nexport interface FinalizeCommand {\n type: 'FINALIZE'\n}\n\n// Messages from Worker to Coordinator\n\nexport type WorkerToCoordinatorEvent =\n | ReadyEvent\n | EnvelopeEvent\n | FinishedEvent\n\nexport interface ReadyEvent {\n type: 'READY'\n}\n\nexport interface EnvelopeEvent {\n type: 'ENVELOPE'\n envelope: Envelope\n}\n\nexport interface FinishedEvent {\n type: 'FINISHED'\n success: boolean\n}\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { WorkerToCoordinatorEvent, CoordinatorToWorkerCommand, InitializeCommand, RunCommand } from './types';
|
|
2
|
-
type IExitFunction = (exitCode: number, error?: Error, message?: string) => void;
|
|
3
|
-
type IMessageSender = (command: WorkerToCoordinatorEvent) => void;
|
|
4
|
-
export declare class ChildProcessWorker {
|
|
5
|
-
private readonly cwd;
|
|
6
|
-
private readonly exit;
|
|
7
|
-
private readonly id;
|
|
8
|
-
private readonly eventBroadcaster;
|
|
9
|
-
private readonly newId;
|
|
10
|
-
private readonly sendMessage;
|
|
11
|
-
private options;
|
|
12
|
-
private supportCodeLibrary;
|
|
13
|
-
private worker;
|
|
14
|
-
constructor({ cwd, exit, id, sendMessage, }: {
|
|
15
|
-
cwd: string;
|
|
16
|
-
exit: IExitFunction;
|
|
17
|
-
id: string;
|
|
18
|
-
sendMessage: IMessageSender;
|
|
19
|
-
});
|
|
20
|
-
initialize({ testRunStartedId, supportCodeCoordinates, supportCodeIds, options, snippetOptions, }: InitializeCommand): Promise<void>;
|
|
21
|
-
finalize(): Promise<void>;
|
|
22
|
-
receiveMessage(command: CoordinatorToWorkerCommand): Promise<void>;
|
|
23
|
-
runTestCase(command: RunCommand): Promise<void>;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
@@ -1,83 +0,0 @@
|
|
|
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.ChildProcessWorker = void 0;
|
|
7
|
-
const node_events_1 = require("node:events");
|
|
8
|
-
const node_url_1 = require("node:url");
|
|
9
|
-
const node_module_1 = require("node:module");
|
|
10
|
-
const messages_1 = require("@cucumber/messages");
|
|
11
|
-
const support_code_library_builder_1 = __importDefault(require("../../support_code_library_builder"));
|
|
12
|
-
const try_require_1 = __importDefault(require("../../try_require"));
|
|
13
|
-
const worker_1 = require("../worker");
|
|
14
|
-
const builder_1 = __importDefault(require("../../formatter/builder"));
|
|
15
|
-
const { uuid } = messages_1.IdGenerator;
|
|
16
|
-
class ChildProcessWorker {
|
|
17
|
-
cwd;
|
|
18
|
-
exit;
|
|
19
|
-
id;
|
|
20
|
-
eventBroadcaster;
|
|
21
|
-
newId;
|
|
22
|
-
sendMessage;
|
|
23
|
-
options;
|
|
24
|
-
supportCodeLibrary;
|
|
25
|
-
worker;
|
|
26
|
-
constructor({ cwd, exit, id, sendMessage, }) {
|
|
27
|
-
this.id = id;
|
|
28
|
-
this.newId = uuid();
|
|
29
|
-
this.cwd = cwd;
|
|
30
|
-
this.exit = exit;
|
|
31
|
-
this.sendMessage = sendMessage;
|
|
32
|
-
this.eventBroadcaster = new node_events_1.EventEmitter();
|
|
33
|
-
this.eventBroadcaster.on('envelope', (envelope) => this.sendMessage({ type: 'ENVELOPE', envelope }));
|
|
34
|
-
}
|
|
35
|
-
async initialize({ testRunStartedId, supportCodeCoordinates, supportCodeIds, options, snippetOptions, }) {
|
|
36
|
-
support_code_library_builder_1.default.reset(this.cwd, this.newId, supportCodeCoordinates);
|
|
37
|
-
supportCodeCoordinates.requireModules.map((module) => (0, try_require_1.default)(module));
|
|
38
|
-
supportCodeCoordinates.requirePaths.map((module) => (0, try_require_1.default)(module));
|
|
39
|
-
for (const specifier of supportCodeCoordinates.loaders) {
|
|
40
|
-
(0, node_module_1.register)(specifier, (0, node_url_1.pathToFileURL)('./'));
|
|
41
|
-
}
|
|
42
|
-
for (const path of supportCodeCoordinates.importPaths) {
|
|
43
|
-
await import((0, node_url_1.pathToFileURL)(path).toString());
|
|
44
|
-
}
|
|
45
|
-
this.supportCodeLibrary = support_code_library_builder_1.default.finalize(supportCodeIds);
|
|
46
|
-
this.options = options;
|
|
47
|
-
const snippetBuilder = await builder_1.default.getStepDefinitionSnippetBuilder({
|
|
48
|
-
cwd: this.cwd,
|
|
49
|
-
snippetInterface: snippetOptions.snippetInterface,
|
|
50
|
-
snippetSyntax: snippetOptions.snippetSyntax,
|
|
51
|
-
supportCodeLibrary: this.supportCodeLibrary,
|
|
52
|
-
});
|
|
53
|
-
this.worker = new worker_1.Worker(testRunStartedId, this.id, this.eventBroadcaster, this.newId, this.options, this.supportCodeLibrary, snippetBuilder);
|
|
54
|
-
await this.worker.runBeforeAllHooks();
|
|
55
|
-
this.sendMessage({ type: 'READY' });
|
|
56
|
-
}
|
|
57
|
-
async finalize() {
|
|
58
|
-
await this.worker.runAfterAllHooks();
|
|
59
|
-
this.exit(0);
|
|
60
|
-
}
|
|
61
|
-
async receiveMessage(command) {
|
|
62
|
-
switch (command.type) {
|
|
63
|
-
case 'INITIALIZE':
|
|
64
|
-
await this.initialize(command);
|
|
65
|
-
break;
|
|
66
|
-
case 'RUN':
|
|
67
|
-
await this.runTestCase(command);
|
|
68
|
-
break;
|
|
69
|
-
case 'FINALIZE':
|
|
70
|
-
await this.finalize();
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
async runTestCase(command) {
|
|
75
|
-
const success = await this.worker.runTestCase(command.assembledTestCase, command.failing);
|
|
76
|
-
this.sendMessage({
|
|
77
|
-
type: 'FINISHED',
|
|
78
|
-
success,
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.ChildProcessWorker = ChildProcessWorker;
|
|
83
|
-
//# sourceMappingURL=worker.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../../src/runtime/parallel/worker.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA0C;AAC1C,uCAAwC;AACxC,6CAAsC;AACtC,iDAA0D;AAC1D,sGAA0E;AAE1E,oEAA0C;AAC1C,sCAAkC;AAElC,sEAAsD;AAQtD,MAAM,EAAE,IAAI,EAAE,GAAG,sBAAW,CAAA;AAK5B,MAAa,kBAAkB;IACZ,GAAG,CAAQ;IACX,IAAI,CAAe;IAEnB,EAAE,CAAQ;IACV,gBAAgB,CAAc;IAC9B,KAAK,CAAmB;IACxB,WAAW,CAAgB;IACpC,OAAO,CAAgB;IACvB,kBAAkB,CAAoB;IACtC,MAAM,CAAQ;IAEtB,YAAY,EACV,GAAG,EACH,IAAI,EACJ,EAAE,EACF,WAAW,GAMZ;QACC,IAAI,CAAC,EAAE,GA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C3C,OAAO,CAAC,iBAAiB,EACzB,OAAO,CAAC,OAAO,CAChB,CAAA;QACD,IAAI,CAAC,WAAW,CAAC;YACf,IAAI,EAAE,UAAU;YAChB,OAAO;SACR,CAAC,CAAA;IACJ,CAAC;CACF;AA5GD,gDA4GC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { pathToFileURL } from 'node:url'\nimport { register } from 'node:module'\nimport { Envelope, IdGenerator } from '@cucumber/messages'\nimport supportCodeLibraryBuilder from '../../support_code_library_builder'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport tryRequire from '../../try_require'\nimport { Worker } from '../worker'\nimport { RuntimeOptions } from '../index'\nimport FormatterBuilder from '../../formatter/builder'\nimport {\n WorkerToCoordinatorEvent,\n CoordinatorToWorkerCommand,\n InitializeCommand,\n RunCommand,\n} from './types'\n\nconst { uuid } = IdGenerator\n\ntype IExitFunction = (exitCode: number, error?: Error, message?: string) => void\ntype IMessageSender = (command: WorkerToCoordinatorEvent) => void\n\nexport class ChildProcessWorker {\n private readonly cwd: string\n private readonly exit: IExitFunction\n\n private readonly id: string\n private readonly eventBroadcaster: EventEmitter\n private readonly newId: IdGenerator.NewId\n private readonly sendMessage: IMessageSender\n private options: RuntimeOptions\n private supportCodeLibrary: SupportCodeLibrary\n private worker: Worker\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: Envelope) =>\n this.sendMessage({ type: 'ENVELOPE', envelope })\n )\n }\n\n async initialize({\n testRunStartedId,\n supportCodeCoordinates,\n supportCodeIds,\n options,\n snippetOptions,\n }: InitializeCommand): Promise<void> {\n supportCodeLibraryBuilder.reset(\n this.cwd,\n this.newId,\n supportCodeCoordinates\n )\n supportCodeCoordinates.requireModules.map((module) => tryRequire(module))\n supportCodeCoordinates.requirePaths.map((module) => tryRequire(module))\n for (const specifier of supportCodeCoordinates.loaders) {\n register(specifier, pathToFileURL('./'))\n }\n for (const path of supportCodeCoordinates.importPaths) {\n await import(pathToFileURL(path).toString())\n }\n this.supportCodeLibrary = supportCodeLibraryBuilder.finalize(supportCodeIds)\n\n this.options = options\n\n const snippetBuilder =\n await FormatterBuilder.getStepDefinitionSnippetBuilder({\n cwd: this.cwd,\n snippetInterface: snippetOptions.snippetInterface,\n snippetSyntax: snippetOptions.snippetSyntax,\n supportCodeLibrary: this.supportCodeLibrary,\n })\n\n this.worker = new Worker(\n testRunStartedId,\n this.id,\n this.eventBroadcaster,\n this.newId,\n this.options,\n this.supportCodeLibrary,\n snippetBuilder\n )\n await this.worker.runBeforeAllHooks()\n this.sendMessage({ type: 'READY' })\n }\n\n async finalize(): Promise<void> {\n await this.worker.runAfterAllHooks()\n this.exit(0)\n }\n\n async receiveMessage(command: CoordinatorToWorkerCommand): Promise<void> {\n switch (command.type) {\n case 'INITIALIZE':\n await this.initialize(command)\n break\n case 'RUN':\n await this.runTestCase(command)\n break\n case 'FINALIZE':\n await this.finalize()\n break\n }\n }\n\n async runTestCase(command: RunCommand): Promise<void> {\n const success = await this.worker.runTestCase(\n command.assembledTestCase,\n command.failing\n )\n this.sendMessage({\n type: 'FINISHED',\n success,\n })\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/scope/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC;AACjC,mDAAgC","sourcesContent":["export * from './test_case_scope'\nexport * from './test_run_scope'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make_proxy.js","sourceRoot":"","sources":["../../../src/runtime/scope/make_proxy.ts"],"names":[],"mappings":";;AAAA,8BAuCC;AAvCD,SAAgB,SAAS,CAAI,QAAmB;IAC9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,CAAA;QAC7D,CAAC;QACD,cAAc,CAAC,CAAC,EAAE,KAAK;YACrB,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,CAAA;QAClD,CAAC;KACF,CACG,CAAA;AACR,CAAC","sourcesContent":["export function makeProxy<T>(getThing: () => any): T {\n return new Proxy(\n {},\n {\n defineProperty(_, property, attributes) {\n return Reflect.defineProperty(getThing(), property, attributes)\n },\n deleteProperty(_, property) {\n return Reflect.get(getThing(), property)\n },\n get(_, property) {\n return Reflect.get(getThing(), property, getThing())\n },\n getOwnPropertyDescriptor(_, property) {\n return Reflect.getOwnPropertyDescriptor(getThing(), property)\n },\n getPrototypeOf(_) {\n return Reflect.getPrototypeOf(getThing())\n },\n has(_, key) {\n return Reflect.has(getThing(), key)\n },\n isExtensible(_) {\n return Reflect.isExtensible(getThing())\n },\n ownKeys(_) {\n return Reflect.ownKeys(getThing())\n },\n preventExtensions(_) {\n return Reflect.preventExtensions(getThing())\n },\n set(_, property, value) {\n return Reflect.set(getThing(), property, value, getThing())\n },\n setPrototypeOf(_, proto) {\n return Reflect.setPrototypeOf(getThing(), proto)\n },\n }\n ) as T\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_scope.js","sourceRoot":"","sources":["../../../src/runtime/scope/test_case_scope.ts"],"names":[],"mappings":";;;AAUA,gDAKC;AAfD,uDAAoD;AAEpD,6CAAwC;AAMxC,MAAM,aAAa,GAAG,IAAI,oCAAiB,EAAsB,CAAA;AAE1D,KAAK,UAAU,kBAAkB,CACtC,KAAyB,EACzB,QAA4B;IAE5B,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC3C,CAAC;AAED,SAAS,QAAQ;IACf,MAAM,KAAK,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAA;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,iGAAiG,CAClG,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAC,KAA+B,CAAA;AAC9C,CAAC;AAED;;;;;;;;;GASG;AACU,QAAA,UAAU,GAAG,IAAA,sBAAS,EAAS,QAAQ,CAAC,CAAA","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { IWorld } from '../../support_code_library_builder/world'\nimport { makeProxy } from './make_proxy'\n\ninterface TestCaseScopeStore<ParametersType = any> {\n world: IWorld<ParametersType>\n}\n\nconst testCaseScope = new AsyncLocalStorage<TestCaseScopeStore>()\n\nexport async function runInTestCaseScope<ResponseType>(\n store: TestCaseScopeStore,\n callback: () => ResponseType\n) {\n return testCaseScope.run(store, callback)\n}\n\nfunction getWorld<ParametersType = any>(): IWorld<ParametersType> {\n const store = testCaseScope.getStore()\n if (!store) {\n throw new Error(\n 'Attempted to access `world` from incorrect scope; only applicable to steps and case-level hooks'\n )\n }\n return store.world as IWorld<ParametersType>\n}\n\n/**\n * A proxy to the World instance for the currently-executing test case\n *\n * @beta\n * @remarks\n * Useful for getting a handle on the World when using arrow functions and thus\n * being unable to rely on the value of `this`. Only callable from the body of a\n * step or a `Before`, `After`, `BeforeStep` or `AfterStep` hook (will throw\n * otherwise).\n */\nexport const worldProxy = makeProxy<IWorld>(getWorld)\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_run_scope.js","sourceRoot":"","sources":["../../../src/runtime/scope/test_run_scope.ts"],"names":[],"mappings":";;;AAUA,8CAKC;AAfD,uDAAoD;AAEpD,6CAAwC;AAMxC,MAAM,YAAY,GAAG,IAAI,oCAAiB,EAAqB,CAAA;AAExD,KAAK,UAAU,iBAAiB,CACrC,KAAwB,EACxB,QAA4B;IAE5B,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAED,SAAS,UAAU;IACjB,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAA;IACrC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACb,wFAAwF,CACzF,CAAA;IACH,CAAC;IACD,OAAO,KAAK,CAAC,OAAmC,CAAA;AAClD,CAAC;AAED;;;;;;;;GAQG;AACU,QAAA,YAAY,GAAG,IAAA,sBAAS,EAAW,UAAU,CAAC,CAAA","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { IContext } from '../../support_code_library_builder/context'\nimport { makeProxy } from './make_proxy'\n\ninterface TestRunScopeStore<ParametersType = any> {\n context: IContext<ParametersType>\n}\n\nconst testRunScope = new AsyncLocalStorage<TestRunScopeStore>()\n\nexport async function runInTestRunScope<ResponseType>(\n store: TestRunScopeStore,\n callback: () => ResponseType\n) {\n return testRunScope.run(store, callback)\n}\n\nfunction getContext<ParametersType = any>(): IContext<ParametersType> {\n const store = testRunScope.getStore()\n if (!store) {\n throw new Error(\n 'Attempted to access `context` from incorrect scope; only applicable to run-level hooks'\n )\n }\n return store.context as IContext<ParametersType>\n}\n\n/**\n * A proxy to the context for the currently-executing test run.\n *\n * @beta\n * @remarks\n * Useful for getting a handle on the context when using arrow functions and thus\n * being unable to rely on the value of `this`. Only callable from the body of a\n * `BeforeAll` or `AfterAll` hook (will throw otherwise).\n */\nexport const contextProxy = makeProxy<IContext>(getContext)\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../../src/runtime/serial/adapter.ts"],"names":[],"mappings":";;;AAIA,sCAAkC;AAKlC,MAAa,gBAAgB;IACV,MAAM,CAAQ;IACvB,OAAO,GAAY,KAAK,CAAA;IAEhC,YACE,gBAAwB,EACxB,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC,EACtC,cAA4C;QAE5C,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CACtB,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,kBAAkB,EAClB,cAAc,CACf,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CACP,kBAAoD;QAEpD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAA;QACrC,KAAK,MAAM,IAAI,IAAI,kBAAkB,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;YACjE,IAAI,CAAC,OAAO,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;YACrB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAA;QACpC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAA;IACtB,CAAC;CACF;AApCD,4CAoCC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport { IdGenerator } from '@cucumber/messages'\nimport { RuntimeAdapter } from '../types'\nimport { AssembledTestCase } from '../../assemble'\nimport { Worker } from '../worker'\nimport { RuntimeOptions } from '../index'\nimport { SupportCodeLibrary } from '../../support_code_library_builder/types'\nimport StepDefinitionSnippetBuilder from '../../formatter/step_definition_snippet_builder'\n\nexport class InProcessAdapter implements RuntimeAdapter {\n private readonly worker: Worker\n private failing: boolean = false\n\n constructor(\n testRunStartedId: string,\n eventBroadcaster: EventEmitter,\n newId: IdGenerator.NewId,\n options: RuntimeOptions,\n supportCodeLibrary: SupportCodeLibrary,\n snippetBuilder: StepDefinitionSnippetBuilder\n ) {\n this.worker = new Worker(\n testRunStartedId,\n undefined,\n eventBroadcaster,\n newId,\n options,\n supportCodeLibrary,\n snippetBuilder\n )\n }\n\n async run(\n assembledTestCases: ReadonlyArray<AssembledTestCase>\n ): Promise<boolean> {\n await this.worker.runBeforeAllHooks()\n for (const item of assembledTestCases) {\n const success = await this.worker.runTestCase(item, this.failing)\n if (!success) {\n this.failing = true\n }\n }\n await this.worker.runAfterAllHooks()\n return !this.failing\n }\n}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E,cAAc,CAAC,IAAI;gBACvB,OAAO,EAAE,KAAK;gBACd,qBAAqB;aACtB,CAAC,CACH,CAAA;YACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;YAClB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACtB,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,cAAc,CAAC,2BAA2B,EAAE,CAAA;QACtD,CAAC;IACH,CAAC;IAED,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC5C,IAAI,MAAqC,CAAA;IACzC,IAAI,OAAO,GAAG,EAAE,CAAA;IAChB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,OAAO,CAAA;IAChD,CAAC;SAAM,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;SAAM,CAAC;QACN,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;IAC/C,CAAC;IAED,IAAI,IAAA,6BAAa,EAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,GAAG,IAAA,0BAAW,EAAC,KAAK,EAAE,iBAAiB,CAAC,CAAA;IACjD,CAAC;IAED,OAAO;QACL,MAAM,EAAE;YACN,QAAQ;YACR,MAAM;YACN,GAAG,OAAO;SACX;QACD,KAAK;KACN,CAAA;AACH,CAAC;AAED,kBAAe,EAAE,GAAG,EAAE,CAAA","sourcesContent":["import * as messages from '@cucumber/messages'\nimport UserCodeRunner from '../user_code_runner'\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 { runInTestCaseScope } from './scope'\nimport { create } from './stopwatch'\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 interface RunStepResult {\n result: messages.TestStepResult\n error?: any\n}\n\nexport async function run({\n defaultTimeout,\n filterStackTraces,\n hookParameter,\n step,\n stepDefinition,\n world,\n}: IRunOptions): Promise<RunStepResult> {\n const stopwatch = create().start()\n let error: any, result: any, invocationData: IGetInvocationDataResponse\n\n try {\n await runInTestCaseScope({ world }, async () => {\n invocationData = await stepDefinition.getInvocationParameters({\n hookParameter,\n step,\n world,\n })\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 runInTestCaseScope({ world }, async () =>\n UserCodeRunner.run({\n argsArray: invocationData.parameters,\n fn: stepDefinition.code,\n thisArg: world,\n timeoutInMilliseconds,\n })\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 status = messages.TestStepResultStatus.FAILED\n } else {\n status = messages.TestStepResultStatus.PASSED\n }\n\n if (doesHaveValue(error)) {\n details = formatError(error, filterStackTraces)\n }\n\n return {\n result: {\n duration,\n status,\n ...details,\n },\n error,\n }\n}\n\nexport default { run }\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stopwatch.js","sourceRoot":"","sources":["../../src/runtime/stopwatch.ts"],"names":[],"mappings":";;;;;;AAAA,iDAA6D;AAC7D,mDAA6B;AAY7B,MAAM,aAAa;IAGG;IAFZ,OAAO,CAAQ;IAEvB,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,CAAC;YACrC,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;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;CACF;AAEM,MAAM,MAAM,GAAG,CAAC,IAAe,EAAc,EAAE,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,CAAA;AAAjE,QAAA,MAAM,UAA2D;AAEvE,MAAM,SAAS,GAAG,GAAG,EAAE,CAC5B,yBAAc,CAAC,iCAAiC,CAAC,cAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;AADzD,QAAA,SAAS,aACgD","sourcesContent":["import { Duration, TimeConversion } 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}\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\nexport const create = (base?: Duration): IStopwatch => new StopwatchImpl(base)\n\nexport const timestamp = () =>\n TimeConversion.millisecondsSinceEpochToTimestamp(methods.Date.now())\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_runner.js","sourceRoot":"","sources":["../../src/runtime/test_case_runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAA8C;AAC9C,iDAI2B;AAU3B,oDAAkE;AAIlE,2CAAuC;AACvC,gEAAyD;AACzD,8EAAoD;AACpD,uCAAqD;AACrD,uDAAkD;AAiBlD,MAAqB,cAAc;IAChB,QAAQ,CAAoB;IAC5B,iBAAiB,CAAmB;IAC7C,wBAAwB,CAAQ;IAChC,iBAAiB,CAAQ;IAChB,gBAAgB,CAAc;IAC9B,eAAe,CAA0B;IACzC,KAAK,CAAmB;IACxB,MAAM,CAAiB;IACvB,QAAQ,CAAmB;IAC3B,WAAW,CAAQ;IACnB,IAAI,CAAS;IACb,iBAAiB,CAAS;IAC1B,kBAAkB,CAAoB;IACtC,cAAc,CAA8B;IACrD,eAAe,CAA2B;IAC1C,KAAK,CAAK;IACD,eAAe,CAAY;IAE5C,YAAY,EACV,QAAQ,EACR,gBAAgB,EAChB,eAAe,EACf,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,GAAG,CAAC,EACX,IAAI,EACJ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,cAAc,GACY;QAC1B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AAa,CAAA;QACxC,OAAO;YACL,MAAM,EAAE,eAAe;YACvB,KAAK;SACN,CAAA;IACH,CAAC;CACF;AAxWD,iCAwWC;AAED,SAAS,kBAAkB,CACzB,EAAU,EACV,kBAAsC;IAEtC,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,kBAAsC;IAEtC,OAAO,kBAAkB,CAAC,eAAe,CAAC,IAAI,CAC5C,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,KAAK,EAAE,CACrC,CAAA;AACH,CAAC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport * as messages from '@cucumber/messages'\nimport {\n Envelope,\n getWorstTestStepResult,\n IdGenerator,\n} from '@cucumber/messages'\nimport { JsonObject } from 'type-fest'\nimport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n SupportCodeLibrary,\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 StepDefinition from '../models/step_definition'\nimport { IWorldOptions } from '../support_code_library_builder/world'\nimport StepDefinitionSnippetBuilder from '../formatter/step_definition_snippet_builder'\nimport { timestamp } from './stopwatch'\nimport StepRunner, { RunStepResult } from './step_runner'\nimport AttachmentManager from './attachment_manager'\nimport { getAmbiguousStepException } from './helpers'\nimport { makeSuggestion } from './make_suggestion'\n\nexport interface INewTestCaseRunnerOptions {\n workerId?: string\n eventBroadcaster: EventEmitter\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: SupportCodeLibrary\n worldParameters: JsonObject\n snippetBuilder: StepDefinitionSnippetBuilder\n}\n\nexport default class TestCaseRunner {\n private readonly workerId: string | undefined\n private readonly attachmentManager: AttachmentManager\n private currentTestCaseStartedId: string\n private currentTestStepId: string\n private readonly eventBroadcaster: EventEmitter\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: SupportCodeLibrary\n private readonly snippetBuilder: StepDefinitionSnippetBuilder\n private testStepResults: messages.TestStepResult[]\n private world: any\n private readonly worldParameters: JsonObject\n\n constructor({\n workerId,\n eventBroadcaster,\n gherkinDocument,\n newId,\n pickle,\n testCase,\n retries = 0,\n skip,\n filterStackTraces,\n supportCodeLibrary,\n worldParameters,\n snippetBuilder,\n }: INewTestCaseRunnerOptions) {\n this.workerId = workerId\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 timestamp: timestamp(),\n },\n }\n this.eventBroadcaster.emit('envelope', attachment)\n }\n )\n this.eventBroadcaster = eventBroadcaster\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.snippetBuilder = snippetBuilder\n this.resetTestProgressData()\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 link: this.attachmentManager.link.bind(this.attachmentManager),\n parameters: structuredClone(this.worldParameters),\n } satisfies IWorldOptions)\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?: ITestCaseHookParameter\n ): Promise<RunStepResult> {\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: 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: 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: timestamp(),\n },\n }\n if (this.workerId) {\n testCaseStarted.testCaseStarted.workerId = this.workerId\n }\n this.eventBroadcaster.emit('envelope', testCaseStarted)\n // used to determine whether a hook is a Before or After\n let didWeRunStepsYet = false\n let error = 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.error = error\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 error = testStepResult.error\n return testStepResult.result\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: timestamp(),\n willBeRetried,\n },\n }\n this.eventBroadcaster.emit('envelope', testCaseFinished)\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 const { result } = await this.invokeStep(\n null,\n hookDefinition,\n hookParameter\n )\n return result\n }\n\n async runStepHooks(\n stepHooks: TestStepHookDefinition[],\n pickleStep: messages.PickleStep,\n stepResult?: RunStepResult\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?.result,\n error: stepResult?.error,\n }\n for (const stepHookDefinition of stepHooks) {\n const { result } = await this.invokeStep(\n null,\n stepHookDefinition,\n hookParameter\n )\n stepHooksResult.push(result)\n }\n return stepHooksResult\n }\n\n async runStep(\n pickleStep: messages.PickleStep,\n testStep: messages.TestStep\n ): Promise<RunStepResult> {\n const stepDefinitions = testStep.stepDefinitionIds.map(\n (stepDefinitionId) => {\n return findStepDefinition(stepDefinitionId, this.supportCodeLibrary)\n }\n )\n if (stepDefinitions.length === 0) {\n this.eventBroadcaster.emit('envelope', {\n suggestion: makeSuggestion({\n newId: this.newId,\n snippetBuilder: this.snippetBuilder,\n pickleStep,\n }),\n } satisfies Envelope)\n return {\n result: {\n status: messages.TestStepResultStatus.UNDEFINED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n } else if (stepDefinitions.length > 1) {\n return {\n result: {\n message: getAmbiguousStepException(stepDefinitions),\n status: messages.TestStepResultStatus.AMBIGUOUS,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n } else if (this.isSkippingSteps()) {\n return {\n result: {\n status: messages.TestStepResultStatus.SKIPPED,\n duration: messages.TimeConversion.millisecondsToDuration(0),\n },\n }\n }\n\n let stepResult\n let error\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.result)\n error = stepResult.error\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 {\n result: finalStepResult,\n error,\n }\n }\n}\n\nfunction findHookDefinition(\n id: string,\n supportCodeLibrary: SupportCodeLibrary\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: SupportCodeLibrary\n): StepDefinition {\n return supportCodeLibrary.stepDefinitions.find(\n (definition) => definition.id === id\n )\n}\n"]}
|
package/lib/runtime/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runtime/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonObject } from 'type-fest'\nimport { AssembledTestCase } from '../assemble'\n\nexport interface RuntimeOptions {\n dryRun: boolean\n failFast: boolean\n filterStacktraces: boolean\n retry: number\n retryTagFilter: string\n strict: boolean\n worldParameters: JsonObject\n}\n\nexport interface Runtime {\n run: () => Promise<boolean>\n}\n\nexport interface RuntimeAdapter {\n run(assembledTestCases: ReadonlyArray<AssembledTestCase>): Promise<boolean>\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"worker.js","sourceRoot":"","sources":["../../src/runtime/worker.ts"],"names":[],"mappings":";;;;;;AACA,iDAK2B;AAG3B,2EAAgD;AAChD,oDAAgE;AAEhE,kDAAqD;AAErD,uCAAgE;AAChE,0EAA+C;AAC/C,mCAA2C;AAC3C,iDAA4C;AAC5C,2CAA+C;AAQ/C,MAAa,MAAM;IAEE;IACA;IACA;IACA;IACA;IACA;IACA;IAPnB,YACmB,gBAAwB,EACxB,QAA4B,EAC5B,gBAA8B,EAC9B,KAAwB,EACxB,OAAuB,EACvB,kBAAsC,EACtC,cAA4C;QAN5C,qBAAgB,GAAhB,gBAAgB,CAAQ;QACxB,aAAQ,GAAR,QAAQ,CAAoB;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAc;QAC9B,UAAK,GAAL,KAAK,CAAmB;QACxB,YAAO,GAAP,OAAO,CAAgB;QACvB,uBAAkB,GAAlB,kBAAkB,CAAoB;QACtC,mBAAc,GAAd,cAAc,CAA8B;IAC5D,CAAC;IAEI,KAAK,CAAC,cAAc,CAC1B,cAAqC;QAErC,MAAM,oBAAoB,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QACzC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE;YACrC,kBAAkB,EAAE;gBAClB,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;gBACvC,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,EAAE,EAAE,oBAAoB;gBACxB,MAAM,EAAE,cAAc,CAAC,EAAE;gBACzB,SAAS,EAAE,IAAA,qBAAS,G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AC,KAAK,CAAA;YACpB,CAAC;QACH,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;CACF;AAvJD,wBAuJC","sourcesContent":["import { EventEmitter } from 'node:events'\nimport {\n Envelope,\n IdGenerator,\n TestStepResult,\n TestStepResultStatus,\n} from '@cucumber/messages'\nimport { AssembledTestCase } from '../assemble'\nimport { SupportCodeLibrary } from '../support_code_library_builder/types'\nimport UserCodeRunner from '../user_code_runner'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport TestRunHookDefinition from '../models/test_run_hook_definition'\nimport { formatLocation } from '../formatter/helpers'\nimport StepDefinitionSnippetBuilder from '../formatter/step_definition_snippet_builder'\nimport { retriesForPickle, shouldCauseFailure } from './helpers'\nimport TestCaseRunner from './test_case_runner'\nimport { runInTestRunScope } from './scope'\nimport { formatError } from './format_error'\nimport { create, timestamp } from './stopwatch'\nimport { RuntimeOptions } from './types'\n\nexport interface RunHookResult {\n result: TestStepResult\n error?: any\n}\n\nexport class Worker {\n constructor(\n private readonly testRunStartedId: string,\n private readonly workerId: string | undefined,\n private readonly eventBroadcaster: EventEmitter,\n private readonly newId: IdGenerator.NewId,\n private readonly options: RuntimeOptions,\n private readonly supportCodeLibrary: SupportCodeLibrary,\n private readonly snippetBuilder: StepDefinitionSnippetBuilder\n ) {}\n\n private async runTestRunHook(\n hookDefinition: TestRunHookDefinition\n ): Promise<RunHookResult> {\n const testRunHookStartedId = this.newId()\n this.eventBroadcaster.emit('envelope', {\n testRunHookStarted: {\n testRunStartedId: this.testRunStartedId,\n workerId: this.workerId,\n id: testRunHookStartedId,\n hookId: hookDefinition.id,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n let result: TestStepResult\n let error: any\n if (this.options.dryRun) {\n result = {\n duration: {\n seconds: 0,\n nanos: 0,\n },\n status: TestStepResultStatus.SKIPPED,\n }\n } else {\n const stopwatch = create().start()\n const context = { parameters: this.options.worldParameters }\n const { error: rawError } = await runInTestRunScope({ context }, () =>\n UserCodeRunner.run({\n argsArray: [],\n fn: hookDefinition.code,\n thisArg: context,\n timeoutInMilliseconds: valueOrDefault(\n hookDefinition.options.timeout,\n this.supportCodeLibrary.defaultTimeout\n ),\n })\n )\n const duration = stopwatch.stop().duration()\n\n if (doesHaveValue(rawError)) {\n result = {\n duration,\n status: TestStepResultStatus.FAILED,\n ...formatError(rawError, this.options.filterStacktraces),\n }\n error = this.wrapTestRunHookError(\n 'a BeforeAll',\n formatLocation(hookDefinition),\n rawError\n )\n } else {\n result = {\n duration,\n status: TestStepResultStatus.PASSED,\n }\n }\n }\n\n this.eventBroadcaster.emit('envelope', {\n testRunHookFinished: {\n testRunHookStartedId,\n result,\n timestamp: timestamp(),\n },\n } satisfies Envelope)\n\n return {\n result,\n error,\n }\n }\n\n private wrapTestRunHookError(\n name: string,\n location: string,\n error: any\n ): any | undefined {\n if (!doesHaveValue(error)) {\n return undefined\n }\n let message = `${name} hook errored`\n if (this.workerId) {\n message += ` on worker ${this.workerId}`\n }\n message += `, process exiting: ${location}`\n return new Error(message, { cause: error })\n }\n\n async runBeforeAllHooks(): Promise<RunHookResult[]> {\n const results: RunHookResult[] = []\n for (const hookDefinition of this.supportCodeLibrary\n .beforeTestRunHookDefinitions) {\n const result = await this.runTestRunHook(hookDefinition)\n results.push(result)\n if (doesHaveValue(result.error)) {\n throw result.error\n }\n }\n return results\n }\n\n async runTestCase(\n { gherkinDocument, pickle, testCase }: AssembledTestCase,\n failing: boolean\n ): Promise<boolean> {\n const testCaseRunner = new TestCaseRunner({\n workerId: this.workerId,\n eventBroadcaster: this.eventBroadcaster,\n newId: this.newId,\n gherkinDocument,\n pickle,\n testCase,\n retries: retriesForPickle(pickle, this.options),\n skip: this.options.dryRun || (this.options.failFast && failing),\n filterStackTraces: this.options.filterStacktraces,\n supportCodeLibrary: this.supportCodeLibrary,\n worldParameters: this.options.worldParameters,\n snippetBuilder: this.snippetBuilder,\n })\n\n const status = await testCaseRunner.run()\n\n return !shouldCauseFailure(status, this.options)\n }\n\n async runAfterAllHooks(): Promise<RunHookResult[]> {\n const results: RunHookResult[] = []\n const reversed = [\n ...this.supportCodeLibrary.afterTestRunHookDefinitions,\n ].reverse()\n for (const hookDefinition of reversed) {\n const result = await this.runTestRunHook(hookDefinition)\n results.push(result)\n if (doesHaveValue(result.error)) {\n throw result.error\n }\n }\n return results\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/sharding/index.ts"],"names":[],"mappings":";;AAAA,uDAAkD;AAElD,kBAAe,gCAAc,CAAA","sourcesContent":["import { shardingPlugin } from './sharding_plugin'\n\nexport default shardingPlugin\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharding_plugin.js","sourceRoot":"","sources":["../../src/sharding/sharding_plugin.ts"],"names":[],"mappings":";;;AAEa,QAAA,cAAc,GAAmB;IAC5C,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5C,SAAS,CAAC,gBAAgB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE;YAC/C,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;gBACnB,OAAO,UAAU,CAAA;YACnB,CAAC;YAED,MAAM,CAAC,aAAa,EAAE,aAAa,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;YAC/D,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,GAAG,CAAC,CAAA;YAClD,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;YAE9C,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,UAAU,KAAK,UAAU,CAAC,CAAA;QACnE,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA","sourcesContent":["import { InternalPlugin } from '../plugin'\n\nexport const shardingPlugin: InternalPlugin = {\n type: 'plugin',\n coordinator: async ({ transform, options }) => {\n transform('pickles:filter', async (allPickles) => {\n if (!options.shard) {\n return allPickles\n }\n\n const [shardIndexStr, shardTotalStr] = options.shard.split('/')\n const shardIndex = parseInt(shardIndexStr, 10) - 1\n const shardTotal = parseInt(shardTotalStr, 10)\n\n return allPickles.filter((_, i) => i % shardTotal === shardIndex)\n })\n },\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step_arguments.js","sourceRoot":"","sources":["../src/step_arguments.ts"],"names":[],"mappings":";;;;;AASA,8CAUC;AAnBD,0DAA4B;AAE5B,mDAA+C;AAO/C,SAAgB,iBAAiB,CAC/B,GAAgC,EAChC,OAA0C;IAE1C,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACjC,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACzC,CAAC;SAAM,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QACxC,OAAO,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACzC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,0BAA0B,mBAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC","sourcesContent":["import util from 'node: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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build_parameter_type.js","sourceRoot":"","sources":["../../src/support_code_library_builder/build_parameter_type.ts"],"names":[],"mappings":";;AAGA,gDAiBC;AApBD,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","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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/support_code_library_builder/context.ts"],"names":[],"mappings":"","sourcesContent":["export interface IContext<ParametersType = any> {\n readonly parameters: ParametersType\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
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":";;;;;AAOA,0DA0BC;AAjCD,0DAA4B;AAC5B,uCAAwC;AACxC,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,CAAC;QACvB,IAAI,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;QACjC,GAAG,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;QAC9B,IAAI,IAAA,6BAAa,EAAC,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC9B,GAAG,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;YAC1B,CAAC;YACD,GAAG,GAAG,mBAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;QAC/B,CAAC;IACH,CAAC;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","sourcesContent":["import path from 'node:path'\nimport { fileURLToPath } from 'node:url'\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 if (uri.startsWith('file://')) {\n uri = fileURLToPath(uri)\n }\n uri = path.relative(cwd, uri)\n }\n }\n\n return {\n line: valueOrDefault(line, 0),\n uri: valueOrDefault(uri, 'unknown'),\n }\n}\n"]}
|