@cucumber/cucumber 12.8.3 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +13 -28
- 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 +8 -7
- package/lib/api/run_cucumber.d.ts +3 -3
- package/lib/api/run_cucumber.js +17 -1
- 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/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 +19 -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 +2 -2
- 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 +7 -6
- 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 +3 -5
- 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 +2 -2
- package/lib/formatter/helpers/event_data_collector.js +4 -6
- 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 +1 -1
- 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 +5 -5
- 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 +2 -2
- package/lib/formatter/helpers/pickle_parser.js +8 -9
- package/lib/formatter/helpers/step_argument_formatter.d.ts +1 -1
- package/lib/formatter/helpers/step_argument_formatter.js +1 -1
- package/lib/formatter/helpers/summary_helpers.d.ts +2 -2
- package/lib/formatter/helpers/summary_helpers.js +8 -4
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +4 -4
- package/lib/formatter/helpers/test_case_attempt_formatter.js +5 -5
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +4 -4
- package/lib/formatter/helpers/test_case_attempt_parser.js +4 -9
- package/lib/formatter/helpers/usage_helpers/index.d.ts +3 -3
- package/lib/formatter/helpers/usage_helpers/index.js +5 -6
- 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 +2 -2
- package/lib/formatter/json_formatter.js +9 -14
- package/lib/formatter/progress_formatter.d.ts +4 -1
- package/lib/formatter/progress_formatter.js +4 -1
- package/lib/formatter/rerun_formatter.d.ts +1 -1
- package/lib/formatter/rerun_formatter.js +2 -2
- 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 +2 -2
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +4 -4
- 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 +6 -3
- package/lib/formatter/summary_formatter.js +6 -3
- package/lib/formatter/usage_formatter.d.ts +1 -1
- package/lib/formatter/usage_formatter.js +4 -4
- package/lib/formatter/usage_json_formatter.d.ts +1 -1
- package/lib/formatter/usage_json_formatter.js +3 -3
- package/lib/index.d.ts +6 -11
- package/lib/index.js +13 -20
- package/lib/models/data_table.d.ts +1 -1
- package/lib/models/data_table.js +9 -5
- package/lib/models/definition.d.ts +4 -4
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- 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 +6 -3
- package/lib/plugin/plugin_manager.js +33 -22
- package/lib/plugin/types.d.ts +76 -10
- package/lib/plugin/types.js +1 -1
- package/lib/publish/index.js +1 -1
- package/lib/publish/publish_plugin.d.ts +2 -2
- package/lib/publish/publish_plugin.js +29 -24
- package/lib/publish/types.js +1 -1
- package/lib/runtime/attachment_manager/index.d.ts +1 -1
- package/lib/runtime/attachment_manager/index.js +3 -6
- package/lib/runtime/coordinator.d.ts +13 -6
- package/lib/runtime/coordinator.js +26 -18
- package/lib/runtime/format_error.d.ts +1 -1
- package/lib/runtime/format_error.js +43 -15
- package/lib/runtime/helpers.d.ts +2 -2
- package/lib/runtime/helpers.js +2 -2
- package/lib/runtime/index.js +1 -1
- package/lib/runtime/make_runtime.d.ts +10 -9
- package/lib/runtime/make_runtime.js +4 -5
- package/lib/runtime/make_suggestion.d.ts +2 -2
- package/lib/runtime/make_suggestion.js +1 -1
- package/lib/runtime/parallel/adapter.d.ts +27 -39
- package/lib/runtime/parallel/adapter.js +124 -122
- 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 +2 -2
- package/lib/runtime/step_runner.js +2 -2
- package/lib/runtime/stopwatch.d.ts +1 -1
- package/lib/runtime/stopwatch.js +1 -1
- package/lib/runtime/test_case_runner.d.ts +10 -9
- package/lib/runtime/test_case_runner.js +20 -12
- package/lib/runtime/types.d.ts +7 -3
- 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 +2 -2
- package/lib/sharding/sharding_plugin.js +1 -1
- package/lib/step_arguments.d.ts +1 -1
- 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 -7
- 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 +8 -8
- 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.js +2 -2
- 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 +2 -2
- package/lib/wrapper.mjs +1 -5
- package/package.json +40 -63
- 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":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,yEAGuC;AAEvC,wCAAwC;AACxC,yDAAwD;AACxD,uDAAmD;AAanD,MAAqB,4BAA4B;IAC9B,aAAa,CAAgB;IAC7B,2BAA2B,CAA6B;IAEzE,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG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qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;QAClB,CAAC;IACH,CAAC;IAED,qBAAqB,CAAC,IAAyB;QAC7C,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,MAAM,YAAY,GAAG,IAAA,kCAAiB,EAAC,IAAI,CAAC,QAAQ,EAAE;gBACpD,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;gBAC5B,SAAS,EAAE,GAAG,EAAE,CAAC,WAAW;aAC7B,CAAC,CAAA;YACF,OAAO,CAAC,YAAY,CAAC,CAAA;QACvB,CAAC;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAnED,+CAmEC","sourcesContent":["import {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as messages from '@cucumber/messages'\nimport { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { doesHaveValue } from '../../value_checker'\nimport { ISnippetSnytax } from './snippet_syntax'\n\nexport interface INewStepDefinitionSnippetBuilderOptions {\n snippetSyntax: ISnippetSnytax\n parameterTypeRegistry: ParameterTypeRegistry\n}\n\nexport interface IBuildRequest {\n keywordType: KeywordType\n pickleStep: messages.PickleStep\n}\n\nexport default class StepDefinitionSnippetBuilder {\n private readonly snippetSyntax: ISnippetSnytax\n private readonly cucumberExpressionGenerator: CucumberExpressionGenerator\n\n constructor({\n snippetSyntax,\n parameterTypeRegistry,\n }: INewStepDefinitionSnippetBuilderOptions) {\n this.snippetSyntax = snippetSyntax\n this.cucumberExpressionGenerator = new CucumberExpressionGenerator(\n () => parameterTypeRegistry.parameterTypes\n )\n }\n\n build({ keywordType, pickleStep }: IBuildRequest): string {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions =\n this.cucumberExpressionGenerator.generateExpressions(pickleStep.text)\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions,\n stepParameterNames,\n })\n }\n\n buildMultiple({ keywordType, pickleStep }: IBuildRequest): string[] {\n const comment =\n 'Write code here that turns the phrase above into concrete actions'\n const functionName = this.getFunctionName(keywordType)\n const generatedExpressions =\n this.cucumberExpressionGenerator.generateExpressions(pickleStep.text)\n const stepParameterNames = this.getStepParameterNames(pickleStep)\n return generatedExpressions.map((generatedExpression) => {\n return this.snippetSyntax.build({\n comment,\n functionName,\n generatedExpressions: [generatedExpression],\n stepParameterNames,\n })\n })\n }\n\n getFunctionName(keywordType: KeywordType): string {\n switch (keywordType) {\n case KeywordType.Event:\n return 'When'\n case KeywordType.Outcome:\n return 'Then'\n case KeywordType.Precondition:\n return 'Given'\n }\n }\n\n getStepParameterNames(step: messages.PickleStep): string[] {\n if (doesHaveValue(step.argument)) {\n const argumentName = parseStepArgument(step.argument, {\n dataTable: () => 'dataTable',\n docString: () => 'docString',\n })\n return [argumentName]\n }\n return []\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"javascript_snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/javascript_snippet_syntax.ts"],"names":[],"mappings":";;AACA,qDAIyB;AAEzB,MAAM,aAAa,GAAG,UAAU,CAAA;AAEhC,MAAqB,uBAAuB;IACzB,gBAAgB,CAAkB;IAEnD,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAA;IAC1C,CAAC;IAED,KAAK,CAAC,EACJ,OAAO,EACP,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,GACS;QAC3B,IAAI,eAAe,GAAG,WAAW,CAAA;QACjC,IAAI,IAAI,CAAC,gBAAgB,KAAK,iCAAgB,CAAC,UAAU,EAAE,CAAC;YAC1D,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;QAC9C,C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D;QAC9D,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACpC,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAxDD,0CAwDC","sourcesContent":["import { GeneratedExpression } from '@cucumber/cucumber-expressions'\nimport {\n ISnippetSnytax,\n ISnippetSyntaxBuildOptions,\n SnippetInterface,\n} from './snippet_syntax'\n\nconst CALLBACK_NAME = 'callback'\n\nexport default class JavaScriptSnippetSyntax implements ISnippetSnytax {\n private readonly snippetInterface: SnippetInterface\n\n constructor(snippetInterface: SnippetInterface) {\n this.snippetInterface = snippetInterface\n }\n\n build({\n comment,\n generatedExpressions,\n functionName,\n stepParameterNames,\n }: ISnippetSyntaxBuildOptions): string {\n let functionKeyword = 'function '\n if (this.snippetInterface === SnippetInterface.AsyncAwait) {\n functionKeyword = 'async ' + functionKeyword\n }\n\n let implementation: string\n if (this.snippetInterface === SnippetInterface.Callback) {\n implementation = `${CALLBACK_NAME}(null, 'pending');`\n } else if (this.snippetInterface === SnippetInterface.Promise) {\n implementation = \"return Promise.resolve('pending');\"\n } else {\n implementation = \"return 'pending';\"\n }\n\n const definitionChoices = generatedExpressions.map(\n (generatedExpression, index) => {\n const prefix = index === 0 ? '' : '// '\n const allParameterNames =\n generatedExpression.parameterNames.concat(stepParameterNames)\n if (this.snippetInterface === SnippetInterface.Callback) {\n allParameterNames.push(CALLBACK_NAME)\n }\n return `${prefix + functionName}('${this.escapeSpecialCharacters(\n generatedExpression\n )}', ${functionKeyword}(${allParameterNames.join(', ')}) {\\n`\n }\n )\n\n return (\n `${definitionChoices.join('')} // ${comment}\\n` +\n ` ${implementation}\\n` +\n '});'\n )\n }\n\n private escapeSpecialCharacters(generatedExpression: GeneratedExpression) {\n let source = generatedExpression.source\n // double up any backslashes because we're in a javascript string\n source = source.replace(/\\\\/g, '\\\\\\\\')\n // escape any single quotes because that's our quote delimiter\n source = source.replace(/'/g, \"\\\\'\")\n return source\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snippet_syntax.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/snippet_syntax.ts"],"names":[],"mappings":";;;AAEA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,8CAA0B,CAAA;IAC1B,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;IACnB,+CAA2B,CAAA;AAC7B,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B","sourcesContent":["import { GeneratedExpression } from '@cucumber/cucumber-expressions'\n\nexport enum SnippetInterface {\n AsyncAwait = 'async-await',\n Callback = 'callback',\n Promise = 'promise',\n Synchronous = 'synchronous',\n}\n\nexport interface ISnippetSyntaxBuildOptions {\n comment: string\n functionName: string\n generatedExpressions: readonly GeneratedExpression[]\n stepParameterNames: string[]\n}\n\nexport interface ISnippetSnytax {\n build: (options: ISnippetSyntaxBuildOptions) => string\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"summary_formatter.js","sourceRoot":"","sources":["../../src/formatter/summary_formatter.ts"],"names":[],"mappings":";;;;;AACA,oDAAgD;AAChD,kCAAmD;AACnD,uCAA4E;AAE5E,2DAAuE;AACvE,0CAAiD;AAOjD,MAAqB,gBAAiB,SAAQ,UAAS;IAC9C,MAAM,CAAU,aAAa,GAClC,yCAAyC,CAAA;IAE3C,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,uBAA2C,CAAA;QAC/C,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;gBAC3C,uBAAuB,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAA;YAC7D,CAAC;YACD,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;g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,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;QACzD,CAAC;QACD,IAAI,CAAC,GAAG,CACN,IAAA,uBAAa,EAAC;YACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,gBAAgB;YAChB,eAAe;SAChB,CAAC,CACH,CAAA;IACH,CAAC;IAED,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAqB;QAC5C,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,CAAA;QACzB,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE;YACxC,IAAI,CAAC,GAAG,CACN,IAAA,qBAAW,EAAC;gBACV,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,KAAK,GAAG,CAAC;gBACjB,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;gBACf,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;aACxC,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;;AAhFH,mCAiFC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../value_checker'\nimport { durationBetweenTimestamps } from '../time'\nimport { formatIssue, formatSummary, isFailure, isWarning } from './helpers'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { formatUndefinedParameterTypes } from './helpers/issue_helpers'\nimport Formatter, { IFormatterOptions } from './'\n\ninterface ILogIssuesRequest {\n issues: ITestCaseAttempt[]\n title: string\n}\n\nexport default class SummaryFormatter extends Formatter {\n public static readonly documentation: string =\n 'Summary output of feature and scenarios'\n\n constructor(options: IFormatterOptions) {\n super(options)\n let testRunStartedTimestamp: messages.Timestamp\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunStarted)) {\n testRunStartedTimestamp = envelope.testRunStarted.timestamp\n }\n if (doesHaveValue(envelope.testRunFinished)) {\n const testRunFinishedTimestamp = envelope.testRunFinished.timestamp\n this.logSummary(\n durationBetweenTimestamps(\n testRunStartedTimestamp,\n testRunFinishedTimestamp\n )\n )\n }\n })\n }\n\n logSummary(testRunDuration: messages.Duration): void {\n const failures: ITestCaseAttempt[] = []\n const warnings: ITestCaseAttempt[] = []\n const testCaseAttempts = this.eventDataCollector.getTestCaseAttempts()\n testCaseAttempts.forEach((testCaseAttempt) => {\n if (\n isFailure(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n failures.push(testCaseAttempt)\n } else if (\n isWarning(\n testCaseAttempt.worstTestStepResult,\n testCaseAttempt.willBeRetried\n )\n ) {\n warnings.push(testCaseAttempt)\n }\n })\n if (this.eventDataCollector.undefinedParameterTypes.length > 0) {\n this.log(\n formatUndefinedParameterTypes(\n this.eventDataCollector.undefinedParameterTypes\n )\n )\n }\n if (failures.length > 0) {\n this.logIssues({ issues: failures, title: 'Failures' })\n }\n if (warnings.length > 0) {\n this.logIssues({ issues: warnings, title: 'Warnings' })\n }\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts,\n testRunDuration,\n })\n )\n }\n\n logIssues({ issues, title }: ILogIssuesRequest): void {\n this.log(`${title}:\\n\\n`)\n issues.forEach((testCaseAttempt, index) => {\n this.log(\n formatIssue({\n colorFns: this.colorFns,\n number: index + 1,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n printAttachments: this.printAttachments,\n })\n )\n })\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAA8B;AAC9B,6DAA8C;AAC9C,oDAAgD;AAChD,uCAAoD;AACpD,0CAAiD;AAGjD,MAAqB,cAAe,SAAQ,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CAAC;YACD,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAQ,CAAC,CAAA;QACxE,CAAC,CACF,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;;AAvEH,iCAwEC","sourcesContent":["import Table from 'cli-table3'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../value_checker'\nimport { formatLocation, getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageFormatter extends Formatter {\n public static readonly documentation: string =\n 'Prints where step definitions are used. The slowest step definitions (with duration) are listed first. If --dry-run is used the duration is not shown, and step definitions are sorted by filename instead.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n if (usage.length === 0) {\n this.log('No step definitions')\n return\n }\n const table = new Table({\n head: ['Pattern / Text', 'Duration', 'Location'],\n style: {\n border: [],\n head: [],\n },\n })\n usage.forEach(\n ({ line, matches, meanDuration, pattern, patternType, uri }) => {\n let formattedPattern = pattern\n if (patternType === 'RegularExpression') {\n formattedPattern = '/' + formattedPattern + '/'\n }\n const col1 = [formattedPattern]\n const col2 = []\n if (matches.length > 0) {\n if (doesHaveValue(meanDuration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n meanDuration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n } else {\n col2.push('UNUSED')\n }\n const col3 = [formatLocation({ line, uri })]\n matches.slice(0, 5).forEach((match) => {\n col1.push(` ${match.text}`)\n if (doesHaveValue(match.duration)) {\n col2.push(\n `${messages.TimeConversion.durationToMilliseconds(\n match.duration\n ).toFixed(2)}ms`\n )\n } else {\n col2.push('-')\n }\n col3.push(formatLocation(match))\n })\n if (matches.length > 5) {\n col1.push(` ${(matches.length - 5).toString()} more`)\n }\n table.push([col1.join('\\n'), col2.join('\\n'), col3.join('\\n')] as any)\n }\n )\n this.log(`${table.toString()}\\n`)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usage_json_formatter.js","sourceRoot":"","sources":["../../src/formatter/usage_json_formatter.ts"],"names":[],"mappings":";;;;;AACA,oDAAgD;AAChD,uCAAoC;AACpC,0CAAiD;AAGjD,MAAqB,kBAAmB,SAAQ,UAAS;IAChD,MAAM,CAAU,aAAa,GAClC,uHAAuH,CAAA;IAEzH,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;gBAC5C,IAAI,CAAC,QAAQ,EAAE,CAAA;YACjB,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC;YACrB,eAAe,EAAE,IAAI,CAAC,kBAAkB,CAAC,eAAe;YACxD,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;SAC5C,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC;IAED,QAAQ,CAAC,GAAW,EAAE,KAAU;QAC9B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAA;QACxB,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;;AA1BH,qCA2BC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../value_checker'\nimport { getUsage } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport IEnvelope = messages.Envelope\n\nexport default class UsageJsonFormatter extends Formatter {\n public static readonly documentation: string =\n 'Does what the Usage Formatter does, but outputs JSON, which can be output to a file and then consumed by other tools.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logUsage()\n }\n })\n }\n\n logUsage(): void {\n const usage = getUsage({\n stepDefinitions: this.supportCodeLibrary.stepDefinitions,\n eventDataCollector: this.eventDataCollector,\n })\n this.log(JSON.stringify(usage, this.replacer, 2))\n }\n\n replacer(key: string, value: any): any {\n if (key === 'seconds') {\n return parseInt(value)\n }\n return value\n }\n}\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAqC;AACrC,6DAA8C;AAC9C,gDAAuC;AACvC,sEAAuD;AA0B9C,4CAAgB;AAzBzB,qHAAsG;AAmD7F,4DAAwB;AAlDjC,kGAAsE;AACtE,uCAA+C;AAE/C,uEAAuE;AAC1D,QAAA,OAAO,GAAG,iBAAkB,CAAA;AAKzC,YAAY;AACZ,+EAAqF;AAA5E,0JAAA,OAAO,OAA6B;AAC7C,kDAA0D;AAAjD,wHAAA,OAAO,OAAa;AAC7B,gFAAsF;AAA7E,oJAAA,OAAO,OAA0B;AAE1C,aAAa;AACb,yCAAqE;AAA5D,uHAAA,OAAO,OAAa;AAC7B,+CAAiE;AAAxD,4HAAA,OAAO,O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C,QAAA,MAAM,GAAG,QAAQ,CAAC,oBAAoB,CAAA;AAEnD,eAAe;AACf,+BAA+C;AAAtC,8GAAA,sBAAsB,OAAA;AAE/B,aAAa;AACb;;GAEG;AACU,QAAA,GAAG,GAAG,IAAA,qBAAS,EAC1B,aAAI,EACJ,4HAA4H,CAC7H,CAAA","sourcesContent":["/**\n * User code functions and helpers\n *\n * @packageDocumentation\n * @module (root)\n * @remarks\n * These docs cover the functions and helpers for user code registration and test setup. The entry point is `@cucumber/cucumber`.\n */\n\nimport { deprecate } from 'node:util'\nimport * as messages from '@cucumber/messages'\nimport { default as _Cli } from './cli'\nimport * as formatterHelpers from './formatter/helpers'\nimport * as parallelCanAssignHelpers from './support_code_library_builder/parallel_can_assign_helpers'\nimport supportCodeLibraryBuilder from './support_code_library_builder'\nimport { version as _version } from './version'\n\n// type version as string to avoid tripping api-extractor every release\nexport const version = _version as string\n\n// Configuration\nexport { IConfiguration, IProfiles } from './configuration'\n\n// Top level\nexport { default as supportCodeLibraryBuilder } from './support_code_library_builder'\nexport { default as DataTable } from './models/data_table'\nexport { default as TestCaseHookDefinition } from './models/test_case_hook_definition'\n\n// Formatters\nexport { default as Formatter, IFormatterOptions } from './formatter'\nexport { default as FormatterBuilder } from './formatter/builder'\nexport { default as JsonFormatter } from './formatter/json_formatter'\nexport { default as ProgressFormatter } from './formatter/progress_formatter'\nexport { default as RerunFormatter } from './formatter/rerun_formatter'\nexport { default as SnippetsFormatter } from './formatter/snippets_formatter'\nexport { default as SummaryFormatter } from './formatter/summary_formatter'\nexport { default as UsageFormatter } from './formatter/usage_formatter'\nexport { default as UsageJsonFormatter } from './formatter/usage_json_formatter'\nexport { formatterHelpers }\n\n// Support Code Functions\nconst { methods } = supportCodeLibraryBuilder\nexport const After = methods.After\nexport const AfterAll = methods.AfterAll\nexport const AfterStep = methods.AfterStep\nexport const Before = methods.Before\nexport const BeforeAll = methods.BeforeAll\nexport const BeforeStep = methods.BeforeStep\nexport const defineStep = methods.defineStep\nexport const defineParameterType = methods.defineParameterType\nexport const Given = methods.Given\nexport const setDefaultTimeout = methods.setDefaultTimeout\nexport const setDefinitionFunctionWrapper = methods.setDefinitionFunctionWrapper\nexport const setWorldConstructor = methods.setWorldConstructor\nexport const setParallelCanAssign = methods.setParallelCanAssign\nexport const Then = methods.Then\nexport const When = methods.When\nexport {\n default as World,\n IWorld,\n IWorldOptions,\n} from './support_code_library_builder/world'\nexport { IContext } from './support_code_library_builder/context'\nexport { worldProxy as world, contextProxy as context } from './runtime/scope'\nexport { parallelCanAssignHelpers }\n\nexport {\n ITestCaseHookParameter,\n ITestStepHookParameter,\n} from './support_code_library_builder/types'\nexport const Status = messages.TestStepResultStatus\n\n// Time helpers\nexport { wrapPromiseWithTimeout } from './time'\n\n// Deprecated\n/**\n * @deprecated use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md\n */\nexport const Cli = deprecate(\n _Cli,\n '`Cli` is deprecated, use `runCucumber` instead; see https://github.com/cucumber/cucumber-js/blob/main/docs/deprecations.md'\n)\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"data_table.js","sourceRoot":"","sources":["../../src/models/data_table.ts"],"names":[],"mappings":";;AAEA,MAAqB,SAAS;IACX,QAAQ,CAAY;IAErC,YAAY,WAA8C;QACxD,IAAI,WAAW,YAAY,KAAK,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAA;QAC7B,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAC3C,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CACpC,CAAA;QACH,CAAC;IACH,CAAC;IAED,MAAM;QACJ,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;QACvB,MAAM,IAA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,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/C,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC/B,CAAA;QACD,OAAO,IAAI,SAAS,CAAC,UAAU,CAAC,CAAA;IAClC,CAAC;CACF;AArDD,4BAqDC","sourcesContent":["import * as messages from '@cucumber/messages'\n\nexport default class DataTable {\n private readonly rawTable: string[][]\n\n constructor(sourceTable: messages.PickleTable | string[][]) {\n if (sourceTable instanceof Array) {\n this.rawTable = sourceTable\n } else {\n this.rawTable = sourceTable.rows.map((row) =>\n row.cells.map((cell) => cell.value)\n )\n }\n }\n\n hashes(): Record<string, string>[] {\n const copy = this.raw()\n const keys = copy[0]\n const valuesArray = copy.slice(1)\n return valuesArray.map((values) => {\n const rowObject: Record<string, string> = {}\n keys.forEach((key, index) => (rowObject[key] = values[index]))\n return rowObject\n })\n }\n\n raw(): string[][] {\n return this.rawTable.slice(0)\n }\n\n rows(): string[][] {\n const copy = this.raw()\n copy.shift()\n return copy\n }\n\n rowsHash(): Record<string, string> {\n const rows = this.raw()\n const everyRowHasTwoColumns = rows.every((row) => row.length === 2)\n if (!everyRowHasTwoColumns) {\n throw new Error(\n 'rowsHash can only be called on a data table where all rows have exactly two columns'\n )\n }\n const result: Record<string, string> = {}\n rows.forEach((x) => (result[x[0]] = x[1]))\n return result\n }\n\n transpose(): DataTable {\n const transposed = this.rawTable[0].map((x, i) =>\n this.rawTable.map((y) => y[i])\n )\n return new DataTable(transposed)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/models/definition.ts"],"names":[],"mappings":";;AA0DA,MAA8B,UAAU;IACtB,IAAI,CAAU;IACd,EAAE,CAAQ;IACV,IAAI,CAAQ;IACZ,OAAO,CAAoB;IAC3B,KAAK,CAAQ;IACb,aAAa,CAAU;IACvB,GAAG,CAAQ;IAE3B,YAAY,EACV,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,OAAO,EACP,KAAK,EACL,aAAa,EACb,GAAG,GACuC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;IAChB,CAAC;IAED,6BAA6B,CAC3B,mBAAoC,EACpC,cAA+B;QAE/B,OAAO,CACL,gBAAgB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,YAAY;YACvD,iBAAiB,mBAAmB,CAAC,QAAQ,EAAE,0CAA0C;YACzF,OAAO,cAAc,CAAC,QAAQ,EAAE,4BAA4B,CAC7D,CAAA;IACH,CAAC;IAED,+BAA+B,CAAC,UAAiB;QAC/C,OAAO,IAAI,CAAC,6BAA6B,CACvC,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,MAAM,GAAG,CAAC,CACtB,CAAA;IACH,CAAC;CACF;AA5CD,6BA4CC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { Expression } from '@cucumber/cucumber-expressions'\nimport { ITestCaseHookParameter } from '../support_code_library_builder/types'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport interface IGetInvocationDataRequest {\n hookParameter: ITestCaseHookParameter\n step: messages.PickleStep\n world: any\n}\n\nexport interface IGetInvocationDataResponse {\n getInvalidCodeLengthMessage: () => string\n parameters: any[]\n validCodeLengths: number[]\n}\n\nexport interface IDefinitionOptions {\n timeout?: number\n wrapperOptions?: any\n}\n\nexport interface IHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n tags?: string\n}\n\nexport interface IDefinitionParameters<T extends IDefinitionOptions> {\n code: Function\n id: string\n line: number\n options: T\n order: number\n unwrappedCode?: Function\n uri: string\n}\n\nexport interface IStepDefinitionParameters\n extends IDefinitionParameters<IDefinitionOptions> {\n keyword: GherkinStepKeyword\n pattern: string | RegExp\n expression: Expression\n}\n\nexport interface IDefinition {\n readonly code: Function\n readonly id: string\n readonly line: number\n readonly options: IDefinitionOptions\n readonly order: number\n readonly unwrappedCode: Function\n readonly uri: string\n\n getInvocationParameters: (\n options: IGetInvocationDataRequest\n ) => Promise<IGetInvocationDataResponse>\n}\n\nexport default abstract class Definition {\n public readonly code: Function\n public readonly id: string\n public readonly line: number\n public readonly options: IDefinitionOptions\n public readonly order: number\n public readonly unwrappedCode: Function\n public readonly uri: string\n\n constructor({\n code,\n id,\n line,\n options,\n order,\n unwrappedCode,\n uri,\n }: IDefinitionParameters<IDefinitionOptions>) {\n this.code = code\n this.id = id\n this.line = line\n this.options = options\n this.order = order\n this.unwrappedCode = unwrappedCode\n this.uri = uri\n }\n\n buildInvalidCodeLengthMessage(\n syncOrPromiseLength: number | string,\n callbackLength: number | string\n ): string {\n return (\n `function has ${this.code.length.toString()} arguments` +\n `, should have ${syncOrPromiseLength.toString()} (if synchronous or returning a promise)` +\n ` or ${callbackLength.toString()} (if accepting a callback)`\n )\n }\n\n baseGetInvalidCodeLengthMessage(parameters: any[]): string {\n return this.buildInvalidCodeLengthMessage(\n parameters.length,\n parameters.length + 1\n )\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"gherkin_step_keyword.js","sourceRoot":"","sources":["../../src/models/gherkin_step_keyword.ts"],"names":[],"mappings":"","sourcesContent":["export type GherkinStepKeyword = 'Unknown' | 'Given' | 'When' | 'Then'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"step_definition.js","sourceRoot":"","sources":["../../src/models/step_definition.ts"],"names":[],"mappings":";;;;;AACA,sDAAqD;AACrD,oDAAgD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AgB;QAC9B,OAAO,IAAA,6BAAa,EAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IACvD,CAAC;CACF;AArCD,iCAqCC","sourcesContent":["import { Expression } from '@cucumber/cucumber-expressions'\nimport { parseStepArgument } from '../step_arguments'\nimport { doesHaveValue } from '../value_checker'\nimport DataTable from './data_table'\nimport Definition, {\n IDefinition,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IStepDefinitionParameters,\n} from './definition'\nimport { GherkinStepKeyword } from './gherkin_step_keyword'\n\nexport default class StepDefinition extends Definition implements IDefinition {\n public readonly keyword: GherkinStepKeyword\n public readonly pattern: string | RegExp\n public readonly expression: Expression\n\n constructor(data: IStepDefinitionParameters) {\n super(data)\n this.keyword = data.keyword\n this.pattern = data.pattern\n this.expression = data.expression\n }\n\n async getInvocationParameters({\n step,\n world,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n const parameters = await Promise.all(\n this.expression.match(step.text).map((arg) => arg.getValue(world))\n )\n if (doesHaveValue(step.argument)) {\n const argumentParameter = parseStepArgument<any>(step.argument, {\n dataTable: (arg) => new DataTable(arg),\n docString: (arg) => arg.content,\n })\n parameters.push(argumentParameter)\n }\n return {\n getInvalidCodeLengthMessage: () =>\n this.baseGetInvalidCodeLengthMessage(parameters),\n parameters,\n validCodeLengths: [parameters.length, parameters.length + 1],\n }\n }\n\n matchesStepName(stepName: string): boolean {\n return doesHaveValue(this.expression.match(stepName))\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_case_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_case_hook_definition.ts"],"names":[],"mappings":";;;;;AACA,oDAAkD;AAClD,8DAMqB;AAErB,MAAqB,sBACnB,SAAQ,oBAAU;IAGF,IAAI,CAAQ;IACZ,aAAa,CAAQ;IACpB,eAAe,CAAiB;IAEjD,YAAY,IAAmD;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QAC7B,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,+BAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,iBAAiB,CAAC,MAAuB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,aAAa,GACa;QAC1B,OAAO;YACL,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC;YACnD,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAA;IACH,CAAC;CACF;AA7BD,yCA6BC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { PickleTagFilter } from '../pickle_filter'\nimport Definition, {\n IDefinition,\n IDefinitionParameters,\n IGetInvocationDataRequest,\n IGetInvocationDataResponse,\n IHookDefinitionOptions,\n} from './definition'\n\nexport default class TestCaseHookDefinition\n extends Definition\n implements IDefinition\n{\n public readonly name: string\n public readonly tagExpression: string\n private readonly pickleTagFilter: PickleTagFilter\n\n constructor(data: IDefinitionParameters<IHookDefinitionOptions>) {\n super(data)\n this.name = data.options.name\n this.tagExpression = data.options.tags\n this.pickleTagFilter = new PickleTagFilter(data.options.tags)\n }\n\n appliesToTestCase(pickle: messages.Pickle): boolean {\n return this.pickleTagFilter.matchesAllTagExpressions(pickle)\n }\n\n async getInvocationParameters({\n hookParameter,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n return {\n getInvalidCodeLengthMessage: () =>\n this.buildInvalidCodeLengthMessage('0 or 1', '2'),\n parameters: [hookParameter],\n validCodeLengths: [0, 1, 2],\n }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_run_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_run_hook_definition.ts"],"names":[],"mappings":";;;;;AAAA,8DAGqB;AAMrB,MAAqB,qBAAsB,SAAQ,oBAAU;IAC3C,IAAI,CAAQ;IAE5B,YAAY,IAA0D;QACpE,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;IAC/B,CAAC;CACF;AAPD,wCAOC","sourcesContent":["import Definition, {\n IDefinitionParameters,\n IDefinitionOptions,\n} from './definition'\n\nexport interface ITestRunHookDefinitionOptions extends IDefinitionOptions {\n name?: string\n}\n\nexport default class TestRunHookDefinition extends Definition {\n public readonly name: string\n\n constructor(data: IDefinitionParameters<ITestRunHookDefinitionOptions>) {\n super(data)\n this.name = data.options.name\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test_step_hook_definition.js","sourceRoot":"","sources":["../../src/models/test_step_hook_definition.ts"],"names":[],"mappings":";;;;;AACA,oDAAkD;AAClD,8DAMqB;AAErB,MAAqB,sBACnB,SAAQ,oBAAU;IAGF,aAAa,CAAQ;IACpB,eAAe,CAAiB;IAEjD,YAAY,IAAmD;QAC7D,KAAK,CAAC,IAAI,CAAC,CAAA;QACX,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAA;QACtC,IAAI,CAAC,eAAe,GAAG,IAAI,+BAAe,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/D,CAAC;IAED,iBAAiB,CAAC,MAAuB;QACvC,OAAO,IAAI,CAAC,eAAe,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAA;IAC9D,CAAC;IAED,KAAK,CAAC,uBAAuB,CAAC,EAC5B,aAAa,GACa;QAC1B,OAAO;YACL,2BAA2B,EAAE,GAAG,EAAE,CAChC,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,GAAG,CAAC;YACnD,UAAU,EAAE,CAAC,aAAa,CAAC;YAC3B,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAA;IACH,CAAC;CACF;AA3BD,yCA2BC","sourcesContent":["import * as messages from '@cucumber/messages'\nimport { PickleTagFilter } from '../pickle_filter'\nimport Definition, {\n IDefinition,\n IGetInvocationDataResponse,\n IGetInvocationDataRequest,\n IDefinitionParameters,\n IHookDefinitionOptions,\n} from './definition'\n\nexport default class TestStepHookDefinition\n extends Definition\n implements IDefinition\n{\n public readonly tagExpression: string\n private readonly pickleTagFilter: PickleTagFilter\n\n constructor(data: IDefinitionParameters<IHookDefinitionOptions>) {\n super(data)\n this.tagExpression = data.options.tags\n this.pickleTagFilter = new PickleTagFilter(data.options.tags)\n }\n\n appliesToTestCase(pickle: messages.Pickle): boolean {\n return this.pickleTagFilter.matchesAllTagExpressions(pickle)\n }\n\n async getInvocationParameters({\n hookParameter,\n }: IGetInvocationDataRequest): Promise<IGetInvocationDataResponse> {\n return {\n getInvalidCodeLengthMessage: () =>\n this.buildInvalidCodeLengthMessage('0 or 1', '2'),\n parameters: [hookParameter],\n validCodeLengths: [0, 1, 2],\n }\n }\n}\n"]}
|
package/lib/paths/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/paths/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,0CAAuB","sourcesContent":["export * from './paths'\nexport * from './types'\n"]}
|
package/lib/paths/paths.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/paths/paths.ts"],"names":[],"mappings":";;;;;AAOA,oCAwCC;AA/CD,0DAA4B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A,CAAC,qBAAqB;IACxF,OAAO,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,UAAU,CAAC,CAAA;AACzD,CAAC;AAED,KAAK,UAAU,kBAAkB,CAC/B,GAAW,EACX,YAAsB,EACtB,sBAAgC,EAChC,qBAA+B;IAK/B,IACE,sBAAsB,CAAC,MAAM,KAAK,CAAC;QACnC,qBAAqB,CAAC,MAAM,KAAK,CAAC,EAClC,CAAC;QACD,MAAM,YAAY,GAAG,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChE,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,GAAG,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAA;QAC1E,OAAO,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,EAAE,CAAA;IAC1C,CAAC;IACD,MAAM,YAAY,GAChB,sBAAsB,CAAC,MAAM,GAAG,CAAC;QAC/B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,sBAAsB,EAAE,KAAK,CAAC;QACvD,CAAC,CAAC,EAAE,CAAA;IACR,MAAM,WAAW,GACf,qBAAqB,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,MAAM,WAAW,CAAC,GAAG,EAAE,qBAAqB,EAAE,gBAAgB,CAAC;QACjE,CAAC,CAAC,EAAE,CAAA;IACR,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AACtC,CAAC","sourcesContent":["import path from 'node:path'\nimport { glob } from 'glob'\nimport fs from 'mz/fs'\nimport { ILogger } from '../environment'\nimport { ISourcesCoordinates, ISupportCodeCoordinates } from '../api'\nimport { IResolvedPaths } from './types'\n\nexport async function resolvePaths(\n logger: ILogger,\n cwd: string,\n sources: Pick<ISourcesCoordinates, 'paths'>,\n support: ISupportCodeCoordinates = {\n requireModules: [],\n requirePaths: [],\n importPaths: [],\n loaders: [],\n }\n): Promise<IResolvedPaths> {\n const unexpandedSourcePaths = await getUnexpandedSourcePaths(\n cwd,\n sources.paths\n )\n const sourcePaths: string[] = await expandSourcePaths(\n cwd,\n unexpandedSourcePaths\n )\n logger.debug('Found source files based on configuration:', sourcePaths)\n const { requirePaths, importPaths } = await deriveSupportPaths(\n cwd,\n sourcePaths,\n support.requirePaths,\n support.importPaths\n )\n logger.debug(\n 'Found support files to load via `require` based on configuration:',\n requirePaths\n )\n logger.debug(\n 'Found support files to load via `import` based on configuration:',\n importPaths\n )\n return {\n unexpandedSourcePaths: unexpandedSourcePaths,\n sourcePaths: sourcePaths,\n requirePaths,\n importPaths,\n }\n}\n\nasync function expandPaths(\n cwd: string,\n unexpandedPaths: string[],\n defaultExtension: string\n): Promise<string[]> {\n const expandedPaths = await Promise.all(\n unexpandedPaths.map(async (unexpandedPath) => {\n const matches = await glob(unexpandedPath, {\n absolute: true,\n windowsPathsNoEscape: true,\n cwd,\n })\n const expanded = await Promise.all(\n matches.map(async (match) => {\n if (path.extname(match) === '') {\n return glob(`${match}/**/*${defaultExtension}`, {\n windowsPathsNoEscape: true,\n })\n }\n return [match]\n })\n )\n return expanded.flat().sort()\n })\n )\n const normalized = expandedPaths.flat().map((x) => path.normalize(x))\n return [...new Set(normalized)]\n}\n\nasync function getUnexpandedSourcePaths(\n cwd: string,\n args: string[]\n): Promise<string[]> {\n if (args.length > 0) {\n const nestedFeaturePaths = await Promise.all(\n args.map(async (arg) => {\n const filename = path.basename(arg)\n if (filename[0] === '@') {\n const filePath = path.join(cwd, arg)\n const content = await fs.readFile(filePath, 'utf8')\n return content.split('\\n').map((x) => x.trim())\n }\n return [arg]\n })\n )\n const featurePaths = nestedFeaturePaths.flat()\n if (featurePaths.length > 0) {\n return featurePaths.filter((x) => x !== '')\n }\n }\n return ['features/**/*.{feature,feature.md}']\n}\n\nfunction getFeatureDirectoryPaths(\n cwd: string,\n featurePaths: string[]\n): string[] {\n const featureDirs = featurePaths.map((featurePath) => {\n let featureDir = path.dirname(featurePath)\n let childDir: string\n let parentDir = featureDir\n while (childDir !== parentDir) {\n childDir = parentDir\n parentDir = path.dirname(childDir)\n if (path.basename(parentDir) === 'features') {\n featureDir = parentDir\n break\n }\n }\n return path.relative(cwd, featureDir)\n })\n return [...new Set(featureDirs)]\n}\n\nasync function expandSourcePaths(\n cwd: string,\n featurePaths: string[]\n): Promise<string[]> {\n featurePaths = featurePaths.map((p) => p.replace(/(:\\d+)*$/g, '')) // Strip line numbers\n return await expandPaths(cwd, featurePaths, '.feature')\n}\n\nasync function deriveSupportPaths(\n cwd: string,\n featurePaths: string[],\n unexpandedRequirePaths: string[],\n unexpandedImportPaths: string[]\n): Promise<{\n requirePaths: string[]\n importPaths: string[]\n}> {\n if (\n unexpandedRequirePaths.length === 0 &&\n unexpandedImportPaths.length === 0\n ) {\n const defaultPaths = getFeatureDirectoryPaths(cwd, featurePaths)\n const importPaths = await expandPaths(cwd, defaultPaths, '.@(js|cjs|mjs)')\n return { requirePaths: [], importPaths }\n }\n const requirePaths =\n unexpandedRequirePaths.length > 0\n ? await expandPaths(cwd, unexpandedRequirePaths, '.js')\n : []\n const importPaths =\n unexpandedImportPaths.length > 0\n ? await expandPaths(cwd, unexpandedImportPaths, '.@(js|cjs|mjs)')\n : []\n return { requirePaths, importPaths }\n}\n"]}
|
package/lib/paths/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/paths/types.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Paths that woll be used to load feature files and user code\n * @public\n * @remarks\n * These values are the result of pre-processing to expand globs, expand\n * directory references, and apply defaults where applicable.\n */\nexport interface IResolvedPaths {\n unexpandedSourcePaths: string[]\n sourcePaths: string[]\n requirePaths: string[]\n importPaths: string[]\n}\n"]}
|
package/lib/pickle_filter.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pickle_filter.js","sourceRoot":"","sources":["../src/pickle_filter.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA4B;AAC5B,+DAAuD;AAE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xE,CAAC;CACF;AAfD,0CAeC","sourcesContent":["import path from 'node:path'\nimport { Node, parse } from '@cucumber/tag-expressions'\nimport * as messages from '@cucumber/messages'\nimport { getGherkinScenarioLocationMap } from './formatter/helpers/gherkin_document_parser'\nimport { doesHaveValue, doesNotHaveValue } from './value_checker'\nimport IGherkinDocument = messages.GherkinDocument\nimport IPickle = messages.Pickle\n\nconst FEATURE_LINENUM_REGEXP = /^(.*?)((?::[\\d]+)+)?$/\n\nexport interface IPickleFilterOptions {\n cwd: string\n featurePaths?: string[]\n names?: string[]\n tagExpression?: string\n}\n\nexport interface IMatchesAnyLineRequest {\n gherkinDocument: messages.GherkinDocument\n pickle: messages.Pickle\n}\n\nexport default class PickleFilter {\n private readonly lineFilter: PickleLineFilter\n private readonly nameFilter: PickleNameFilter\n private readonly tagFilter: PickleTagFilter\n\n constructor({\n cwd,\n featurePaths,\n names,\n tagExpression,\n }: IPickleFilterOptions) {\n this.lineFilter = new PickleLineFilter(cwd, featurePaths)\n this.nameFilter = new PickleNameFilter(names)\n this.tagFilter = new PickleTagFilter(tagExpression)\n }\n\n matches({\n gherkinDocument,\n pickle,\n }: {\n gherkinDocument: IGherkinDocument\n pickle: IPickle\n }): boolean {\n return (\n this.lineFilter.matchesAnyLine({ gherkinDocument, pickle }) &&\n this.nameFilter.matchesAnyName(pickle) &&\n this.tagFilter.matchesAllTagExpressions(pickle)\n )\n }\n}\n\nexport class PickleLineFilter {\n private readonly featureUriToLinesMapping: Record<string, number[]>\n\n constructor(cwd: string, featurePaths: string[] = []) {\n this.featureUriToLinesMapping = this.getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n })\n }\n\n getFeatureUriToLinesMapping({\n cwd,\n featurePaths,\n }: {\n cwd: string\n featurePaths: string[]\n }): Record<string, number[]> {\n const mapping: Record<string, number[]> = {}\n featurePaths.forEach((featurePath) => {\n const match = FEATURE_LINENUM_REGEXP.exec(featurePath)\n if (doesHaveValue(match)) {\n let uri = match[1]\n if (path.isAbsolute(uri)) {\n uri = path.relative(cwd, uri)\n } else {\n uri = path.normalize(uri)\n }\n const linesExpression = match[2]\n if (doesHaveValue(linesExpression)) {\n if (doesNotHaveValue(mapping[uri])) {\n mapping[uri] = []\n }\n linesExpression\n .slice(1)\n .split(':')\n .forEach((line) => {\n mapping[uri].push(parseInt(line))\n })\n }\n }\n })\n return mapping\n }\n\n matchesAnyLine({ gherkinDocument, pickle }: IMatchesAnyLineRequest): boolean {\n const uri = path.normalize(pickle.uri)\n const linesToMatch = this.featureUriToLinesMapping[uri]\n if (doesHaveValue(linesToMatch)) {\n const gherkinScenarioLocationMap =\n getGherkinScenarioLocationMap(gherkinDocument)\n const pickleLines = new Set(\n pickle.astNodeIds.map(\n (sourceId) => gherkinScenarioLocationMap[sourceId].line\n )\n )\n const linesIntersection = linesToMatch.filter((x) => pickleLines.has(x))\n return linesIntersection.length > 0\n }\n return true\n }\n}\n\nexport class PickleNameFilter {\n private readonly names: string[]\n\n constructor(names: string[] = []) {\n this.names = names\n }\n\n matchesAnyName(pickle: messages.Pickle): boolean {\n if (this.names.length === 0) {\n return true\n }\n return this.names.some((name) => pickle.name.match(name))\n }\n}\n\nexport class PickleTagFilter {\n private readonly tagExpressionNode: Node\n\n constructor(tagExpression: string) {\n if (doesHaveValue(tagExpression) && tagExpression !== '') {\n this.tagExpressionNode = parse(tagExpression)\n }\n }\n\n matchesAllTagExpressions(pickle: messages.Pickle): boolean {\n if (doesNotHaveValue(this.tagExpressionNode)) {\n return true\n }\n return this.tagExpressionNode.evaluate(pickle.tags.map((x) => x.name))\n }\n}\n"]}
|
package/lib/plugin/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/plugin/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,mDAAgC","sourcesContent":["export * from './types'\nexport * from './plugin_manager'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version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B,KAAK,IAAI,EAAE,CAAC,MAAM,SAAS,EAAE,EAC7B,SAAS,EACT,WAAW,SAAS,kCAAkC,CACvD,CAAA;QACH,CAAC;IACH,CAAC;CACF;AArJD,sCAqJC;AAED,SAAS,SAAS,CAAI,EAAW,EAAE,SAAiB,EAAE,OAAe;IACnE,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC5C,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,EAAoB,EACpB,SAAiB,EACjB,OAAe;IAEf,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAA;IACnB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;QAC5C,CAAC;QACD,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC","sourcesContent":["import { UsableEnvironment } from '../environment'\nimport {\n CoordinatorEventHandler,\n CoordinatorEventKey,\n CoordinatorEventValues,\n CoordinatorTransformer,\n CoordinatorTransformKey,\n CoordinatorTransformValues,\n FormatterPlugin,\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 }\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 initCoordinator<OptionsType>(\n operation: PluginOperation,\n plugin: Plugin<OptionsType>,\n options: OptionsType,\n specifier?: string\n ) {\n const context = {\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 const cleanupFn = await wrapErrorAsync(\n async () => await plugin.coordinator(context),\n specifier,\n `Plugin \"${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 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 specifier,\n `Plugin \"${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 specifier,\n `Plugin \"${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 specifier,\n `Plugin \"${specifier}\" errored when trying to cleanup`\n )\n }\n }\n}\n\nfunction wrapError<T>(fn: () => T, specifier: string, message: string): T {\n try {\n return fn()\n } catch (error) {\n if (specifier) {\n throw new Error(message, { cause: error })\n }\n throw error\n }\n}\n\nasync function wrapErrorAsync<T>(\n fn: () => Promise<T>,\n specifier: string,\n message: string\n): Promise<T> {\n try {\n return await fn()\n } catch (error) {\n if (specifier) {\n throw new Error(message, { cause: error })\n }\n throw 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'\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}\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\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;AAG9B,MAAM,4BAA4B,GAAG,0CAA0C,CAAA;AAElE,QAAA,aAAa,GAAW;IACnC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE;QAC1D,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,EAAE,CAAA;QAC7C,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;QACnD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,CAAA;QAEzC,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;YACtB,OAAO,GAAG,EAAE;gBACV,IAAI,aAAa,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;oBAC/B,WAAW,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,G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AK,CAAC,SAAS,EAAE;wBAC5C,MAAM,EAAE,KAAK;wBACb,OAAO,EAAE;4BACP,cAAc,EAAE,mBAAmB;4BACnC,kBAAkB,EAAE,MAAM;4BAC1B,gBAAgB,EAAE,aAAa;yBAChC;wBACD,IAAI,EAAE,IAAA,0BAAgB,EAAC,YAAY,CAAC;wBACpC,MAAM,EAAE,MAAM;qBACf,CAAC,CAAA;oBACF,IAAI,cAAc,CAAC,EAAE,EAAE,CAAC;wBACtB,WAAW,CAAC,MAAM,CAAC,KAAK,CACtB,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CACzD,CAAA;oBACH,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,KAAK,CACV,8BACE,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,MACrB,gBAAgB,cAAc,CAAC,MAAM,EAAE,CACxC,CAAA;wBACD,MAAM,CAAC,KAAK,CAAC,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,CAAA;oBAC3C,CAAC;oBACD,OAAO,EAAE,CAAA;gBACX,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAA;IACH,CAAC;CACF,CAAA;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,GAAW,EAAE,MAAgB;IAC1D,IAAI,CAAC,IAAA,8BAAa,EAAC,MAAM,CAAC,IAAI,IAAA,kBAAO,EAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAA,oCAAwB,EAAC,GAAG,CAAC,CAAA;IACtC,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 { Plugin } from '../plugin'\n\nconst DEFAULT_CUCUMBER_PUBLISH_URL = 'https://messages.cucumber.io/api/reports'\n\nexport const publishPlugin: Plugin = {\n type: 'plugin',\n coordinator: async ({ on, 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 if (token !== undefined) {\n headers.Authorization = `Bearer ${token}`\n }\n const touchResponse = await fetch(url, { headers })\n const banner = await touchResponse.text()\n\n if (!touchResponse.ok) {\n return () => {\n if (touchResponse.status < 500) {\n environment.stderr.write(\n sanitisePublishOutput(banner, environment.stderr) + '\\n'\n )\n } else {\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\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(banner, environment.stderr) + '\\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,CAAC;IAED,GAAG,CAAC,IAAY;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAA;IACvD,CAAC;IAED,IAAI,CAAC,GAAG,GAAa;QACnB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,eAAe,CAAC,CAAA;IACrD,CAAC;IAED,MAAM,CACJ,IAAgC,EAChC,kBAAsD,EACtD,QAAqB;QAErB,MAAM,OAAO,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;QACpD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,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AC;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,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,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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,8DAqCC;AAED,4CAoBC;AAED,gDAgBC;AArFD,4DAA8B;AAC9B,kEAAwC;AACxC,6DAA8C;AAC9C,4EAAsE;AACtE,oDAAkD;AAIlD,SAAgB,yBAAyB,CACvC,eAAiC;IAEjC,MAAM,KAAK,GAAG,IAAI,oBAAK,CAAC;QACtB,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,aAAa,EAAE,EAAE;YACjB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,IAAI,EAAE,EAAE;YACR,UAAU,EAAE,EAAE;YACd,GAAG,EAAE,EAAE;YACP,SA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ACV,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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,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,GAAG,EAAE,CAAA;QACZ,IAAI,CAAC,KAAK,GAAG,IAAI,EAAE,CAAA;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,gBAAgB,GAAG,IAAI,0BAAY,EAAE,CAAA;QAC1C,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAkB,EAAE,EAAE,CAC1D,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EA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,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,kBAAkB,EACvB,cAAc,CACf,CAAA;QACD,MAAM,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,CAAA;QACrC,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAA;IACrC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAA;QACpC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACd,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAmC;QACtD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;YACrB,KAAK,YAAY;gBACf,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;gBAC9B,MAAK;YACP,KAAK,KAAK;gBACR,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;gBAC/B,MAAK;YACP,KAAK,UAAU;gBACb,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAA;gBACrB,MAAK;QACT,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAmB;QACnC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3C,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;IAC9C,OAAO,IAAI,KAAK,CACd,EAAE,EACF;QACE,cAAc,CAAC,CAAC,EAAE,QAAQ,EAAE,UAAU;YACpC,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAA;QACjE,CAAC;QACD,cAAc,CAAC,CAAC,EAAE,QAAQ;YACxB,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAA;QAC1C,CAAC;QACD,GAAG,CAAC,CAAC,EAAE,QAAQ;YACb,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAA;QACtD,CAAC;QACD,wBAAwB,CAAC,CAAC,EAAE,QAAQ;YAClC,OAAO,OAAO,CAAC,wBAAwB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAA;QAC/D,CAAC;QACD,cAAc,CAAC,CAAC;YACd,OAAO,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC3C,CAAC;QACD,GAAG,CAAC,CAAC,EAAE,GAAG;YACR,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAA;QACrC,CAAC;QACD,YAAY,CAAC,CAAC;YACZ,OAAO,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAA;QACzC,CAAC;QACD,OAAO,CAAC,CAAC;YACP,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAA;QACpC,CAAC;QACD,iBAAiB,CAAC,CAAC;YACjB,OAAO,OAAO,CAAC,iBAAiB,CAAC,QAAQ,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK;YACpB,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,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}\n"]}
|