@dev-blinq/cucumber-js 1.0.0-amdocs
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +68 -0
- package/api/index.d.ts +6 -0
- package/bin/cucumber-js +3 -0
- package/bin/cucumber.js +3 -0
- package/bin/cucumber.ts +2 -0
- package/bin/download-install.js +167 -0
- package/lib/api/console_logger.d.ts +12 -0
- package/lib/api/console_logger.js +24 -0
- package/lib/api/console_logger.js.map +1 -0
- package/lib/api/convert_configuration.d.ts +4 -0
- package/lib/api/convert_configuration.js +66 -0
- package/lib/api/convert_configuration.js.map +1 -0
- package/lib/api/environment.d.ts +2 -0
- package/lib/api/environment.js +14 -0
- package/lib/api/environment.js.map +1 -0
- package/lib/api/formatters.d.ts +20 -0
- package/lib/api/formatters.js +61 -0
- package/lib/api/formatters.js.map +1 -0
- package/lib/api/gherkin.d.ts +21 -0
- package/lib/api/gherkin.js +146 -0
- package/lib/api/gherkin.js.map +1 -0
- package/lib/api/index.d.ts +12 -0
- package/lib/api/index.js +28 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/load_configuration.d.ts +9 -0
- package/lib/api/load_configuration.js +41 -0
- package/lib/api/load_configuration.js.map +1 -0
- package/lib/api/load_sources.d.ts +9 -0
- package/lib/api/load_sources.js +53 -0
- package/lib/api/load_sources.js.map +1 -0
- package/lib/api/load_support.d.ts +10 -0
- package/lib/api/load_support.js +30 -0
- package/lib/api/load_support.js.map +1 -0
- package/lib/api/paths.d.ts +8 -0
- package/lib/api/paths.js +102 -0
- package/lib/api/paths.js.map +1 -0
- package/lib/api/plugins.d.ts +4 -0
- package/lib/api/plugins.js +19 -0
- package/lib/api/plugins.js.map +1 -0
- package/lib/api/run_cucumber.d.ts +11 -0
- package/lib/api/run_cucumber.js +115 -0
- package/lib/api/run_cucumber.js.map +1 -0
- package/lib/api/runtime.d.ts +21 -0
- package/lib/api/runtime.js +36 -0
- package/lib/api/runtime.js.map +1 -0
- package/lib/api/support.d.ts +9 -0
- package/lib/api/support.js +26 -0
- package/lib/api/support.js.map +1 -0
- package/lib/api/test_helpers.d.ts +3 -0
- package/lib/api/test_helpers.js +36 -0
- package/lib/api/test_helpers.js.map +1 -0
- package/lib/api/types.d.ts +177 -0
- package/lib/api/types.js +3 -0
- package/lib/api/types.js.map +1 -0
- package/lib/api/wrapper.mjs +6 -0
- package/lib/cli/helpers.d.ts +39 -0
- package/lib/cli/helpers.js +224 -0
- package/lib/cli/helpers.js.map +1 -0
- package/lib/cli/i18n.d.ts +2 -0
- package/lib/cli/i18n.js +70 -0
- package/lib/cli/i18n.js.map +1 -0
- package/lib/cli/index.d.ts +21 -0
- package/lib/cli/index.js +64 -0
- package/lib/cli/index.js.map +1 -0
- package/lib/cli/install_validator.d.ts +1 -0
- package/lib/cli/install_validator.js +18 -0
- package/lib/cli/install_validator.js.map +1 -0
- package/lib/cli/run.d.ts +1 -0
- package/lib/cli/run.js +44 -0
- package/lib/cli/run.js.map +1 -0
- package/lib/cli/validate_node_engine_version.d.ts +10 -0
- package/lib/cli/validate_node_engine_version.js +24 -0
- package/lib/cli/validate_node_engine_version.js.map +1 -0
- package/lib/configuration/argv_parser.d.ts +20 -0
- package/lib/configuration/argv_parser.js +104 -0
- package/lib/configuration/argv_parser.js.map +1 -0
- package/lib/configuration/axios_client.d.ts +1 -0
- package/lib/configuration/axios_client.js +40 -0
- package/lib/configuration/axios_client.js.map +1 -0
- package/lib/configuration/check_schema.d.ts +2 -0
- package/lib/configuration/check_schema.js +60 -0
- package/lib/configuration/check_schema.js.map +1 -0
- package/lib/configuration/default_configuration.d.ts +2 -0
- package/lib/configuration/default_configuration.js +29 -0
- package/lib/configuration/default_configuration.js.map +1 -0
- package/lib/configuration/from_file.d.ts +3 -0
- package/lib/configuration/from_file.js +85 -0
- package/lib/configuration/from_file.js.map +1 -0
- package/lib/configuration/helpers.d.ts +1 -0
- package/lib/configuration/helpers.js +11 -0
- package/lib/configuration/helpers.js.map +1 -0
- package/lib/configuration/index.d.ts +7 -0
- package/lib/configuration/index.js +29 -0
- package/lib/configuration/index.js.map +1 -0
- package/lib/configuration/locate_file.d.ts +1 -0
- package/lib/configuration/locate_file.js +21 -0
- package/lib/configuration/locate_file.js.map +1 -0
- package/lib/configuration/merge_configurations.d.ts +2 -0
- package/lib/configuration/merge_configurations.js +48 -0
- package/lib/configuration/merge_configurations.js.map +1 -0
- package/lib/configuration/option_splitter.d.ts +3 -0
- package/lib/configuration/option_splitter.js +23 -0
- package/lib/configuration/option_splitter.js.map +1 -0
- package/lib/configuration/types.d.ts +30 -0
- package/lib/configuration/types.js +3 -0
- package/lib/configuration/types.js.map +1 -0
- package/lib/configuration/validate_configuration.d.ts +3 -0
- package/lib/configuration/validate_configuration.js +13 -0
- package/lib/configuration/validate_configuration.js.map +1 -0
- package/lib/filter_stack_trace.d.ts +3 -0
- package/lib/filter_stack_trace.js +38 -0
- package/lib/filter_stack_trace.js.map +1 -0
- package/lib/formatter/api.d.ts +2 -0
- package/lib/formatter/api.js +53 -0
- package/lib/formatter/api.js.map +1 -0
- package/lib/formatter/builder.d.ts +37 -0
- package/lib/formatter/builder.js +101 -0
- package/lib/formatter/builder.js.map +1 -0
- package/lib/formatter/bvt_analysis_formatter.d.ts +30 -0
- package/lib/formatter/bvt_analysis_formatter.js +334 -0
- package/lib/formatter/bvt_analysis_formatter.js.map +1 -0
- package/lib/formatter/feature_data_format.d.ts +23 -0
- package/lib/formatter/feature_data_format.js +182 -0
- package/lib/formatter/feature_data_format.js.map +1 -0
- package/lib/formatter/fixtures/typescript.d.ts +2 -0
- package/lib/formatter/fixtures/typescript.js +6 -0
- package/lib/formatter/fixtures/typescript.js.map +1 -0
- package/lib/formatter/get_color_fns.d.ts +15 -0
- package/lib/formatter/get_color_fns.js +56 -0
- package/lib/formatter/get_color_fns.js.map +1 -0
- package/lib/formatter/helpers/constants.d.ts +44 -0
- package/lib/formatter/helpers/constants.js +50 -0
- package/lib/formatter/helpers/constants.js.map +1 -0
- package/lib/formatter/helpers/duration_helpers.d.ts +2 -0
- package/lib/formatter/helpers/duration_helpers.js +9 -0
- package/lib/formatter/helpers/duration_helpers.js.map +1 -0
- package/lib/formatter/helpers/event_data_collector.d.ts +30 -0
- package/lib/formatter/helpers/event_data_collector.js +126 -0
- package/lib/formatter/helpers/event_data_collector.js.map +1 -0
- package/lib/formatter/helpers/formatters.d.ts +6 -0
- package/lib/formatter/helpers/formatters.js +45 -0
- package/lib/formatter/helpers/formatters.js.map +1 -0
- package/lib/formatter/helpers/gherkin_document_parser.d.ts +5 -0
- package/lib/formatter/helpers/gherkin_document_parser.js +66 -0
- package/lib/formatter/helpers/gherkin_document_parser.js.map +1 -0
- package/lib/formatter/helpers/index.d.ts +10 -0
- package/lib/formatter/helpers/index.js +52 -0
- package/lib/formatter/helpers/index.js.map +1 -0
- package/lib/formatter/helpers/issue_helpers.d.ts +19 -0
- package/lib/formatter/helpers/issue_helpers.js +59 -0
- package/lib/formatter/helpers/issue_helpers.js.map +1 -0
- package/lib/formatter/helpers/keyword_type.d.ts +11 -0
- package/lib/formatter/helpers/keyword_type.js +32 -0
- package/lib/formatter/helpers/keyword_type.js.map +1 -0
- package/lib/formatter/helpers/location_helpers.d.ts +2 -0
- package/lib/formatter/helpers/location_helpers.js +17 -0
- package/lib/formatter/helpers/location_helpers.js.map +1 -0
- package/lib/formatter/helpers/pickle_parser.d.ts +17 -0
- package/lib/formatter/helpers/pickle_parser.js +28 -0
- package/lib/formatter/helpers/pickle_parser.js.map +1 -0
- package/lib/formatter/helpers/report_generator.d.ts +148 -0
- package/lib/formatter/helpers/report_generator.js +573 -0
- package/lib/formatter/helpers/report_generator.js.map +1 -0
- package/lib/formatter/helpers/step_argument_formatter.d.ts +2 -0
- package/lib/formatter/helpers/step_argument_formatter.js +48 -0
- package/lib/formatter/helpers/step_argument_formatter.js.map +1 -0
- package/lib/formatter/helpers/summary_helpers.d.ts +9 -0
- package/lib/formatter/helpers/summary_helpers.js +96 -0
- package/lib/formatter/helpers/summary_helpers.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.d.ts +12 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js +114 -0
- package/lib/formatter/helpers/test_case_attempt_formatter.js.map +1 -0
- package/lib/formatter/helpers/test_case_attempt_parser.d.ts +32 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js +135 -0
- package/lib/formatter/helpers/test_case_attempt_parser.js.map +1 -0
- package/lib/formatter/helpers/upload_serivce.d.ts +26 -0
- package/lib/formatter/helpers/upload_serivce.js +237 -0
- package/lib/formatter/helpers/upload_serivce.js.map +1 -0
- package/lib/formatter/helpers/uploader.d.ts +12 -0
- package/lib/formatter/helpers/uploader.js +151 -0
- package/lib/formatter/helpers/uploader.js.map +1 -0
- package/lib/formatter/helpers/usage_helpers/index.d.ts +23 -0
- package/lib/formatter/helpers/usage_helpers/index.js +111 -0
- package/lib/formatter/helpers/usage_helpers/index.js.map +1 -0
- package/lib/formatter/html_formatter.d.ts +7 -0
- package/lib/formatter/html_formatter.js +30 -0
- package/lib/formatter/html_formatter.js.map +1 -0
- package/lib/formatter/index.d.ts +53 -0
- package/lib/formatter/index.js +21 -0
- package/lib/formatter/index.js.map +1 -0
- package/lib/formatter/json_formatter.d.ts +78 -0
- package/lib/formatter/json_formatter.js +230 -0
- package/lib/formatter/json_formatter.js.map +1 -0
- package/lib/formatter/junit_formatter.d.ts +17 -0
- package/lib/formatter/junit_formatter.js +181 -0
- package/lib/formatter/junit_formatter.js.map +1 -0
- package/lib/formatter/message_formatter.d.ts +5 -0
- package/lib/formatter/message_formatter.js +15 -0
- package/lib/formatter/message_formatter.js.map +1 -0
- package/lib/formatter/progress_bar_formatter.d.ts +18 -0
- package/lib/formatter/progress_bar_formatter.js +99 -0
- package/lib/formatter/progress_bar_formatter.js.map +1 -0
- package/lib/formatter/progress_formatter.d.ts +9 -0
- package/lib/formatter/progress_formatter.js +59 -0
- package/lib/formatter/progress_formatter.js.map +1 -0
- package/lib/formatter/rerun_formatter.d.ts +13 -0
- package/lib/formatter/rerun_formatter.js +80 -0
- package/lib/formatter/rerun_formatter.js.map +1 -0
- package/lib/formatter/snippets_formatter.d.ts +6 -0
- package/lib/formatter/snippets_formatter.js +61 -0
- package/lib/formatter/snippets_formatter.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/index.d.ts +20 -0
- package/lib/formatter/step_definition_snippet_builder/index.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/index.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.d.ts +7 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js +46 -0
- package/lib/formatter/step_definition_snippet_builder/javascript_snippet_syntax.js.map +1 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.d.ts +16 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js +11 -0
- package/lib/formatter/step_definition_snippet_builder/snippet_syntax.js.map +1 -0
- package/lib/formatter/summary_formatter.d.ts +14 -0
- package/lib/formatter/summary_formatter.js +68 -0
- package/lib/formatter/summary_formatter.js.map +1 -0
- package/lib/formatter/usage_formatter.d.ts +6 -0
- package/lib/formatter/usage_formatter.js +98 -0
- package/lib/formatter/usage_formatter.js.map +1 -0
- package/lib/formatter/usage_json_formatter.d.ts +7 -0
- package/lib/formatter/usage_json_formatter.js +34 -0
- package/lib/formatter/usage_json_formatter.js.map +1 -0
- package/lib/importer.js +13 -0
- package/lib/index.d.ts +58 -0
- package/lib/index.js +109 -0
- package/lib/index.js.map +1 -0
- package/lib/logger.d.ts +5 -0
- package/lib/logger.js +3 -0
- package/lib/logger.js.map +1 -0
- package/lib/models/data_table.d.ts +10 -0
- package/lib/models/data_table.js +46 -0
- package/lib/models/data_table.js.map +1 -0
- package/lib/models/definition.d.ts +55 -0
- package/lib/models/definition.js +22 -0
- package/lib/models/definition.js.map +1 -0
- package/lib/models/gherkin_step_keyword.d.ts +1 -0
- package/lib/models/gherkin_step_keyword.js +3 -0
- package/lib/models/gherkin_step_keyword.js.map +1 -0
- package/lib/models/pickle_order.d.ts +1 -0
- package/lib/models/pickle_order.js +3 -0
- package/lib/models/pickle_order.js.map +1 -0
- package/lib/models/step_definition.d.ts +11 -0
- package/lib/models/step_definition.js +37 -0
- package/lib/models/step_definition.js.map +1 -0
- package/lib/models/test_case_hook_definition.d.ts +10 -0
- package/lib/models/test_case_hook_definition.js +27 -0
- package/lib/models/test_case_hook_definition.js.map +1 -0
- package/lib/models/test_run_hook_definition.d.ts +3 -0
- package/lib/models/test_run_hook_definition.js +10 -0
- package/lib/models/test_run_hook_definition.js.map +1 -0
- package/lib/models/test_step_hook_definition.d.ts +9 -0
- package/lib/models/test_step_hook_definition.js +26 -0
- package/lib/models/test_step_hook_definition.js.map +1 -0
- package/lib/pickle_filter.d.ts +42 -0
- package/lib/pickle_filter.js +99 -0
- package/lib/pickle_filter.js.map +1 -0
- package/lib/plugin/index.d.ts +2 -0
- package/lib/plugin/index.js +19 -0
- package/lib/plugin/index.js.map +1 -0
- package/lib/plugin/plugin_manager.d.ts +13 -0
- package/lib/plugin/plugin_manager.js +36 -0
- package/lib/plugin/plugin_manager.js.map +1 -0
- package/lib/plugin/types.d.ts +14 -0
- package/lib/plugin/types.js +3 -0
- package/lib/plugin/types.js.map +1 -0
- package/lib/publish/http_stream.d.ts +30 -0
- package/lib/publish/http_stream.js +112 -0
- package/lib/publish/http_stream.js.map +1 -0
- package/lib/publish/index.d.ts +2 -0
- package/lib/publish/index.js +5 -0
- package/lib/publish/index.js.map +1 -0
- package/lib/publish/publish_plugin.d.ts +2 -0
- package/lib/publish/publish_plugin.js +48 -0
- package/lib/publish/publish_plugin.js.map +1 -0
- package/lib/runtime/assemble_test_cases.d.ts +13 -0
- package/lib/runtime/assemble_test_cases.js +88 -0
- package/lib/runtime/assemble_test_cases.js.map +1 -0
- package/lib/runtime/attachment_manager/index.d.ts +33 -0
- package/lib/runtime/attachment_manager/index.js +119 -0
- package/lib/runtime/attachment_manager/index.js.map +1 -0
- package/lib/runtime/format_error.d.ts +2 -0
- package/lib/runtime/format_error.js +36 -0
- package/lib/runtime/format_error.js.map +1 -0
- package/lib/runtime/helpers.d.ts +6 -0
- package/lib/runtime/helpers.js +101 -0
- package/lib/runtime/helpers.js.map +1 -0
- package/lib/runtime/index.d.ts +40 -0
- package/lib/runtime/index.js +76 -0
- package/lib/runtime/index.js.map +1 -0
- package/lib/runtime/parallel/command_types.d.ts +32 -0
- package/lib/runtime/parallel/command_types.js +3 -0
- package/lib/runtime/parallel/command_types.js.map +1 -0
- package/lib/runtime/parallel/coordinator.d.ts +72 -0
- package/lib/runtime/parallel/coordinator.js +222 -0
- package/lib/runtime/parallel/coordinator.js.map +1 -0
- package/lib/runtime/parallel/run_worker.d.ts +1 -0
- package/lib/runtime/parallel/run_worker.js +29 -0
- package/lib/runtime/parallel/run_worker.js.map +1 -0
- package/lib/runtime/parallel/worker.d.ts +26 -0
- package/lib/runtime/parallel/worker.js +87 -0
- package/lib/runtime/parallel/worker.js.map +1 -0
- package/lib/runtime/run_test_run_hooks.d.ts +3 -0
- package/lib/runtime/run_test_run_hooks.js +28 -0
- package/lib/runtime/run_test_run_hooks.js.map +1 -0
- package/lib/runtime/step_runner.d.ts +16 -0
- package/lib/runtime/step_runner.js +88 -0
- package/lib/runtime/step_runner.js.map +1 -0
- package/lib/runtime/stopwatch.d.ts +12 -0
- package/lib/runtime/stopwatch.js +34 -0
- package/lib/runtime/stopwatch.js.map +1 -0
- package/lib/runtime/test_case_runner.d.ts +55 -0
- package/lib/runtime/test_case_runner.js +277 -0
- package/lib/runtime/test_case_runner.js.map +1 -0
- package/lib/step_arguments.d.ts +6 -0
- package/lib/step_arguments.js +19 -0
- package/lib/step_arguments.js.map +1 -0
- package/lib/support_code_library_builder/build_parameter_type.d.ts +3 -0
- package/lib/support_code_library_builder/build_parameter_type.js +13 -0
- package/lib/support_code_library_builder/build_parameter_type.js.map +1 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.d.ts +3 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js +29 -0
- package/lib/support_code_library_builder/get_definition_line_and_uri.js.map +1 -0
- package/lib/support_code_library_builder/index.d.ts +74 -0
- package/lib/support_code_library_builder/index.js +304 -0
- package/lib/support_code_library_builder/index.js.map +1 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.d.ts +2 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js +16 -0
- package/lib/support_code_library_builder/parallel_can_assign_helpers.js.map +1 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.d.ts +7 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js +19 -0
- package/lib/support_code_library_builder/sourced_parameter_type_registry.js.map +1 -0
- package/lib/support_code_library_builder/types.d.ts +88 -0
- package/lib/support_code_library_builder/types.js +3 -0
- package/lib/support_code_library_builder/types.js.map +1 -0
- package/lib/support_code_library_builder/validate_arguments.d.ts +12 -0
- package/lib/support_code_library_builder/validate_arguments.js +73 -0
- package/lib/support_code_library_builder/validate_arguments.js.map +1 -0
- package/lib/support_code_library_builder/world.d.ts +18 -0
- package/lib/support_code_library_builder/world.js +11 -0
- package/lib/support_code_library_builder/world.js.map +1 -0
- package/lib/time.d.ts +18 -0
- package/lib/time.js +61 -0
- package/lib/time.js.map +1 -0
- package/lib/try_require.d.ts +7 -0
- package/lib/try_require.js +26 -0
- package/lib/try_require.js.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib/uncaught_exception_manager.d.ts +7 -0
- package/lib/uncaught_exception_manager.js +12 -0
- package/lib/uncaught_exception_manager.js.map +1 -0
- package/lib/user_code_runner.d.ts +14 -0
- package/lib/user_code_runner.js +82 -0
- package/lib/user_code_runner.js.map +1 -0
- package/lib/value_checker.d.ts +3 -0
- package/lib/value_checker.js +19 -0
- package/lib/value_checker.js.map +1 -0
- package/lib/version.d.ts +1 -0
- package/lib/version.js +6 -0
- package/lib/version.js.map +1 -0
- package/lib/wrapper.mjs +44 -0
- package/package.json +197 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junit_formatter.js","sourceRoot":"","sources":["../../src/formatter/junit_formatter.ts"],"names":[],"mappings":";;;;;AAAA,4DAAmC;AACnC,0CAAiD;AAEjD,iDAS2B;AAE3B,oDAAgD;AAChD,+EAG0C;AAC1C,2DAA0E;AAC1E,oDAAiD;AAiDjD,MAAqB,cAAe,SAAQ,UAAS;IAKnD,YAAY,OAA0B;;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QALC,UAAK,GAA6B,EAAE,CAAA;QAMnD,IAAI,CAAC,SAAS,GAAG,IAAA,8BAAc,EAC7B,MAAA,OAAO,CAAC,iBAAiB,CAAC,KAAK,0CAAE,SAAS,EAC1C,aAAa,CACd,CAAA;QACD,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,iBAAiB,EAAE,CAAA;aACzB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAEO,YAAY;QAClB,OAAO,IAAI,CAAC,kBAAkB;aAC3B,mBAAmB,EAAE;aACrB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;IAChD,CAAC;IAEO,YAAY,CAClB,eAAiC,EACjC,cAA6C,EAC7C,aAAkD;QAElD,OAAO,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACzD,MAAM,YAAY,GAAG,CAAC,IAAA,6BAAa,EAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;YAC1D,OAAO,IAAI,CAAC,WAAW,CAAC;gBACtB,YAAY;gBACZ,cAAc;gBACd,aAAa;gB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,CAAC,SAAS,CAAC,CAAA;aAC3B;iBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,+BAAoB,CAAC,MAAM,EAAE;gBAC7D,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,CAAC,SAAS,EAAE;oBAC5C,IAAI,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,IAAI;oBAC/B,OAAO,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,OAAO,0CAAE,OAAO;iBACtC,CAAC,CAAA;gBACF,IAAI,MAAA,IAAI,CAAC,MAAM,0CAAE,OAAO,EAAE;oBACxB,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;iBAC7C;aACF;YACD,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QAC5D,CAAC,CAAC,CAAA;QAEF,OAAO,SAAS,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;IACxC,CAAC;;AA5NH,iCA6NC;AA1NwB,4BAAa,GAAW,sBAAsB,CAAA","sourcesContent":["import xmlbuilder from 'xmlbuilder'\nimport Formatter, { IFormatterOptions } from './'\nimport * as messages from '@cucumber/messages'\nimport {\n Attachment,\n Duration,\n Feature,\n getWorstTestStepResult,\n Pickle,\n Rule,\n TestStepResult,\n TestStepResultStatus,\n} from '@cucumber/messages'\nimport { ITestCaseAttempt } from './helpers/event_data_collector'\nimport { doesHaveValue } from '../value_checker'\nimport {\n getGherkinExampleRuleMap,\n getGherkinStepMap,\n} from './helpers/gherkin_document_parser'\nimport { getPickleStepMap, getStepKeyword } from './helpers/pickle_parser'\nimport { valueOrDefault } from '../value_checker'\n\ninterface IJUnitTestSuite {\n name: string\n failures: number\n skipped: number\n time: number\n tests: IJUnitTestCase[]\n}\n\ninterface IJUnitTestCase {\n classname: string\n name: string\n time: number\n result: IJUnitTestCaseResult\n systemOutput: string\n steps: IJUnitTestStep[]\n}\n\ninterface IJUnitTestCaseFailure {\n type: string\n message?: string\n detail: string\n}\n\ninterface IJUnitTestCaseResult {\n status: TestStepResultStatus\n failure?: IJUnitTestCaseFailure\n}\n\ninterface IJUnitTestStep {\n attachments: Attachment[]\n hidden: boolean\n keyword: string\n line: number\n name?: string\n result: TestStepResult\n time: number\n}\n\ninterface IBuildJUnitTestStepOptions {\n isBeforeHook: boolean\n gherkinStepMap: Record<string, messages.Step>\n pickleStepMap: Record<string, messages.PickleStep>\n testStep: messages.TestStep\n testStepAttachments: messages.Attachment[]\n testStepResult: messages.TestStepResult\n}\n\nexport default class JunitFormatter extends Formatter {\n private readonly names: Record<string, string[]> = {}\n private readonly suiteName: string\n public static readonly documentation: string = 'Outputs JUnit report'\n\n constructor(options: IFormatterOptions) {\n super(options)\n this.suiteName = valueOrDefault(\n options.parsedArgvOptions.junit?.suiteName,\n 'cucumber-js'\n )\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.onTestRunFinished()\n }\n })\n }\n\n private getTestCases() {\n return this.eventDataCollector\n .getTestCaseAttempts()\n .filter((attempt) => !attempt.willBeRetried)\n }\n\n private getTestSteps(\n testCaseAttempt: ITestCaseAttempt,\n gherkinStepMap: Record<string, messages.Step>,\n pickleStepMap: Record<string, messages.PickleStep>\n ) {\n return testCaseAttempt.testCase.testSteps.map((testStep) => {\n const isBeforeHook = !doesHaveValue(testStep.pickleStepId)\n return this.getTestStep({\n isBeforeHook,\n gherkinStepMap,\n pickleStepMap,\n testStep,\n testStepAttachments: testCaseAttempt.stepAttachments[testStep.id],\n testStepResult: testCaseAttempt.stepResults[testStep.id],\n })\n })\n }\n\n private getTestStep({\n isBeforeHook,\n gherkinStepMap,\n pickleStepMap,\n testStep,\n testStepAttachments,\n testStepResult,\n }: IBuildJUnitTestStepOptions): IJUnitTestStep {\n const data: Partial<IJUnitTestStep> = {}\n if (testStep.pickleStepId) {\n const pickleStep = pickleStepMap[testStep.pickleStepId]\n data.keyword = getStepKeyword({ pickleStep, gherkinStepMap })\n data.line = gherkinStepMap[pickleStep.astNodeIds[0]].location.line\n data.name = pickleStep.text\n } else {\n data.keyword = isBeforeHook ? 'Before' : 'After'\n data.hidden = true\n }\n data.result = testStepResult\n data.time = testStepResult.duration\n ? this.durationToSeconds(testStepResult.duration)\n : 0\n data.attachments = testStepAttachments\n return data as IJUnitTestStep\n }\n\n private getTestCaseResult(steps: IJUnitTestStep[]): IJUnitTestCaseResult {\n const { status, message, exception } = getWorstTestStepResult(\n steps.map((step) => step.result)\n )\n return {\n status,\n failure:\n message || exception\n ? {\n type: exception?.type,\n message: exception?.message,\n detail: message,\n }\n : undefined,\n }\n }\n\n private durationToSeconds(duration: Duration): number {\n const NANOS_IN_SECOND = 1_000_000_000\n return (\n (duration.seconds * NANOS_IN_SECOND + duration.nanos) / NANOS_IN_SECOND\n )\n }\n\n private nameOrDefault(name: string, fallbackSuffix: string): string {\n if (!name) {\n return `(unnamed ${fallbackSuffix})`\n }\n return name\n }\n\n private getTestCaseName(\n feature: Feature,\n rule: Rule | undefined,\n pickle: Pickle\n ) {\n const featureName = this.nameOrDefault(feature.name, 'feature')\n const pickleName = this.nameOrDefault(pickle.name, 'scenario')\n const testCaseName = rule\n ? this.nameOrDefault(rule.name, 'rule') + ': ' + pickleName\n : pickleName\n if (!this.names[featureName]) {\n this.names[featureName] = []\n }\n let index = 0\n while (\n this.names[featureName].includes(\n index > 0 ? `${testCaseName} [${index}]` : testCaseName\n )\n ) {\n index++\n }\n const name = index > 0 ? `${testCaseName} [${index}]` : testCaseName\n this.names[featureName].push(name)\n return name\n }\n\n private formatTestSteps(steps: IJUnitTestStep[]): string {\n return steps\n .filter((step) => !step.hidden)\n .map((step) => {\n const statusText = step.result.status.toLowerCase()\n const maxLength = 80 - statusText.length - 3\n const stepText = `${step.keyword}${step.name}`\n .padEnd(maxLength, '.')\n .substring(0, maxLength)\n return `${stepText}...${statusText}`\n })\n .join('\\n')\n }\n\n private onTestRunFinished(): void {\n const testCases = this.getTestCases()\n\n const tests = testCases.map<IJUnitTestCase>(\n (testCaseAttempt: ITestCaseAttempt) => {\n const { gherkinDocument, pickle } = testCaseAttempt\n const { feature } = gherkinDocument\n const gherkinExampleRuleMap = getGherkinExampleRuleMap(gherkinDocument)\n const rule = gherkinExampleRuleMap[pickle.astNodeIds[0]]\n const gherkinStepMap = getGherkinStepMap(gherkinDocument)\n const pickleStepMap = getPickleStepMap(pickle)\n\n const steps = this.getTestSteps(\n testCaseAttempt,\n gherkinStepMap,\n pickleStepMap\n )\n const stepDuration = steps.reduce(\n (total, step) => total + (step.time || 0),\n 0\n )\n\n return {\n classname: this.nameOrDefault(feature.name, 'feature'),\n name: this.getTestCaseName(feature, rule, pickle),\n time: stepDuration,\n result: this.getTestCaseResult(steps),\n systemOutput: this.formatTestSteps(steps),\n steps,\n }\n }\n )\n\n const passed = tests.filter(\n (item) => item.result.status === TestStepResultStatus.PASSED\n ).length\n const skipped = tests.filter(\n (item) => item.result.status === TestStepResultStatus.SKIPPED\n ).length\n const failures = tests.length - passed - skipped\n\n const testSuite: IJUnitTestSuite = {\n name: this.suiteName,\n tests,\n failures,\n skipped,\n time: tests.reduce((total, test) => total + test.time, 0),\n }\n\n this.log(this.buildXmlReport(testSuite))\n }\n\n private buildXmlReport(testSuite: IJUnitTestSuite): string {\n const xmlReport = xmlbuilder\n .create('testsuite', { invalidCharReplacement: '' })\n .att('failures', testSuite.failures)\n .att('skipped', testSuite.skipped)\n .att('name', testSuite.name)\n .att('time', testSuite.time)\n .att('tests', testSuite.tests.length)\n testSuite.tests.forEach((test) => {\n const xmlTestCase = xmlReport.ele('testcase', {\n classname: test.classname,\n name: test.name,\n time: test.time,\n })\n if (test.result.status === TestStepResultStatus.SKIPPED) {\n xmlTestCase.ele('skipped')\n } else if (test.result.status !== TestStepResultStatus.PASSED) {\n const xmlFailure = xmlTestCase.ele('failure', {\n type: test.result.failure?.type,\n message: test.result.failure?.message,\n })\n if (test.result?.failure) {\n xmlFailure.cdata(test.result.failure.detail)\n }\n }\n xmlTestCase.ele('system-out', {}).cdata(test.systemOutput)\n })\n\n return xmlReport.end({ pretty: true })\n }\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const _1 = __importDefault(require("."));
|
|
7
|
+
class MessageFormatter extends _1.default {
|
|
8
|
+
constructor(options) {
|
|
9
|
+
super(options);
|
|
10
|
+
options.eventBroadcaster.on('envelope', (envelope) => this.log(JSON.stringify(envelope) + '\n'));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = MessageFormatter;
|
|
14
|
+
MessageFormatter.documentation = 'Outputs protobuf messages';
|
|
15
|
+
//# sourceMappingURL=message_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message_formatter.js","sourceRoot":"","sources":["../../src/formatter/message_formatter.ts"],"names":[],"mappings":";;;;;AAAA,yCAAgD;AAGhD,MAAqB,gBAAiB,SAAQ,UAAS;IAErD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE,CACtE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,CAC1C,CAAA;IACH,CAAC;;AAPH,mCAQC;AAPwB,8BAAa,GAAW,2BAA2B,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from '.'\nimport * as messages from '@cucumber/messages'\n\nexport default class MessageFormatter extends Formatter {\n public static readonly documentation: string = 'Outputs protobuf messages'\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) =>\n this.log(JSON.stringify(envelope) + '\\n')\n )\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Formatter, { IFormatterOptions } from './';
|
|
2
|
+
import ProgressBar from 'progress';
|
|
3
|
+
import * as messages from '@cucumber/messages';
|
|
4
|
+
export default class ProgressBarFormatter extends Formatter {
|
|
5
|
+
private numberOfSteps;
|
|
6
|
+
private testRunStarted;
|
|
7
|
+
private issueCount;
|
|
8
|
+
progressBar: ProgressBar;
|
|
9
|
+
static readonly documentation: string;
|
|
10
|
+
constructor(options: IFormatterOptions);
|
|
11
|
+
incrementStepCount(pickleId: string): void;
|
|
12
|
+
initializeProgressBar(): void;
|
|
13
|
+
logProgress({ testStepId, testCaseStartedId, }: messages.TestStepFinished): void;
|
|
14
|
+
logUndefinedParametertype(parameterType: messages.UndefinedParameterType): void;
|
|
15
|
+
logErrorIfNeeded(testCaseFinished: messages.TestCaseFinished): void;
|
|
16
|
+
logSummary(testRunFinished: messages.TestRunFinished): void;
|
|
17
|
+
parseEnvelope(envelope: messages.Envelope): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const _1 = __importDefault(require("./"));
|
|
8
|
+
const progress_1 = __importDefault(require("progress"));
|
|
9
|
+
const value_checker_1 = require("../value_checker");
|
|
10
|
+
const issue_helpers_1 = require("./helpers/issue_helpers");
|
|
11
|
+
const time_1 = require("../time");
|
|
12
|
+
// Inspired by https://github.com/thekompanee/fuubar and https://github.com/martinciu/fuubar-cucumber
|
|
13
|
+
class ProgressBarFormatter extends _1.default {
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super(options);
|
|
16
|
+
options.eventBroadcaster.on('envelope', this.parseEnvelope.bind(this));
|
|
17
|
+
this.numberOfSteps = 0;
|
|
18
|
+
this.issueCount = 0;
|
|
19
|
+
}
|
|
20
|
+
incrementStepCount(pickleId) {
|
|
21
|
+
const pickle = this.eventDataCollector.getPickle(pickleId);
|
|
22
|
+
this.numberOfSteps += pickle.steps.length;
|
|
23
|
+
}
|
|
24
|
+
initializeProgressBar() {
|
|
25
|
+
if ((0, value_checker_1.doesHaveValue)(this.progressBar)) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
this.progressBar = new progress_1.default(':current/:total steps [:bar] ', {
|
|
29
|
+
clear: true,
|
|
30
|
+
incomplete: ' ',
|
|
31
|
+
stream: this.stream,
|
|
32
|
+
total: this.numberOfSteps,
|
|
33
|
+
width: (0, value_checker_1.valueOrDefault)(this.stream.columns, 80),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
logProgress({ testStepId, testCaseStartedId, }) {
|
|
37
|
+
const { testCase } = this.eventDataCollector.getTestCaseAttempt(testCaseStartedId);
|
|
38
|
+
const testStep = testCase.testSteps.find((s) => s.id === testStepId);
|
|
39
|
+
if ((0, value_checker_1.doesHaveValue)(testStep.pickleStepId)) {
|
|
40
|
+
this.progressBar.tick();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
logUndefinedParametertype(parameterType) {
|
|
44
|
+
this.log(`Undefined parameter type: ${(0, issue_helpers_1.formatUndefinedParameterType)(parameterType)}\n`);
|
|
45
|
+
}
|
|
46
|
+
logErrorIfNeeded(testCaseFinished) {
|
|
47
|
+
const { worstTestStepResult } = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
|
|
48
|
+
if ((0, helpers_1.isIssue)(worstTestStepResult)) {
|
|
49
|
+
this.issueCount += 1;
|
|
50
|
+
const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(testCaseFinished.testCaseStartedId);
|
|
51
|
+
this.progressBar.interrupt((0, helpers_1.formatIssue)({
|
|
52
|
+
colorFns: this.colorFns,
|
|
53
|
+
number: this.issueCount,
|
|
54
|
+
snippetBuilder: this.snippetBuilder,
|
|
55
|
+
supportCodeLibrary: this.supportCodeLibrary,
|
|
56
|
+
testCaseAttempt,
|
|
57
|
+
printAttachments: this.printAttachments,
|
|
58
|
+
}));
|
|
59
|
+
if (testCaseFinished.willBeRetried) {
|
|
60
|
+
const stepsToRetry = testCaseAttempt.pickle.steps.length;
|
|
61
|
+
this.progressBar.tick(-stepsToRetry);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
logSummary(testRunFinished) {
|
|
66
|
+
const testRunDuration = (0, time_1.durationBetweenTimestamps)(this.testRunStarted.timestamp, testRunFinished.timestamp);
|
|
67
|
+
this.log((0, helpers_1.formatSummary)({
|
|
68
|
+
colorFns: this.colorFns,
|
|
69
|
+
testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(),
|
|
70
|
+
testRunDuration,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
parseEnvelope(envelope) {
|
|
74
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.undefinedParameterType)) {
|
|
75
|
+
this.logUndefinedParametertype(envelope.undefinedParameterType);
|
|
76
|
+
}
|
|
77
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testCase)) {
|
|
78
|
+
this.incrementStepCount(envelope.testCase.pickleId);
|
|
79
|
+
}
|
|
80
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepStarted)) {
|
|
81
|
+
this.initializeProgressBar();
|
|
82
|
+
}
|
|
83
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
|
|
84
|
+
this.logProgress(envelope.testStepFinished);
|
|
85
|
+
}
|
|
86
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testCaseFinished)) {
|
|
87
|
+
this.logErrorIfNeeded(envelope.testCaseFinished);
|
|
88
|
+
}
|
|
89
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testRunStarted)) {
|
|
90
|
+
this.testRunStarted = envelope.testRunStarted;
|
|
91
|
+
}
|
|
92
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
93
|
+
this.logSummary(envelope.testRunFinished);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.default = ProgressBarFormatter;
|
|
98
|
+
ProgressBarFormatter.documentation = 'Similar to the Progress Formatter, but provides a real-time updating progress bar based on the total number of steps to be executed in the test run';
|
|
99
|
+
//# sourceMappingURL=progress_bar_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress_bar_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_bar_formatter.ts"],"names":[],"mappings":";;;;;AAAA,uCAA+D;AAC/D,0CAAiD;AACjD,wDAAkC;AAGlC,oDAAgE;AAChE,2DAAsE;AACtE,kCAAmD;AAEnD,qGAAqG;AACrG,MAAqB,oBAAqB,SAAQ,UAAS;IAQzD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QACtE,IAAI,CAAC,aAAa,GAAG,CAAC,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAA;IACrB,CAAC;IAED,kBAAkB,CAAC,QAAgB;QACjC,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAA;QAC1D,IAAI,CAAC,aAAa,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAA;IAC3C,CAAC;IAED,qBAAqB;QACnB,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,WA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Aa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YACnD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;SAC5C;aAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;YACnD,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;SACjD;aAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,cAAc,CAAC,EAAE;YACjD,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,cAAc,CAAA;SAC9C;aAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAClD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAA;SAC1C;IACH,CAAC;;AA/GH,uCAgHC;AA3GwB,kCAAa,GAClC,qJAAqJ,CAAA","sourcesContent":["import { formatIssue, formatSummary, isIssue } from './helpers'\nimport Formatter, { IFormatterOptions } from './'\nimport ProgressBar from 'progress'\nimport { WriteStream as TtyWriteStream } from 'tty'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue, valueOrDefault } from '../value_checker'\nimport { formatUndefinedParameterType } from './helpers/issue_helpers'\nimport { durationBetweenTimestamps } from '../time'\n\n// Inspired by https://github.com/thekompanee/fuubar and https://github.com/martinciu/fuubar-cucumber\nexport default class ProgressBarFormatter extends Formatter {\n private numberOfSteps: number\n private testRunStarted: messages.TestRunStarted\n private issueCount: number\n public progressBar: ProgressBar\n public static readonly documentation: string =\n 'Similar to the Progress Formatter, but provides a real-time updating progress bar based on the total number of steps to be executed in the test run'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', this.parseEnvelope.bind(this))\n this.numberOfSteps = 0\n this.issueCount = 0\n }\n\n incrementStepCount(pickleId: string): void {\n const pickle = this.eventDataCollector.getPickle(pickleId)\n this.numberOfSteps += pickle.steps.length\n }\n\n initializeProgressBar(): void {\n if (doesHaveValue(this.progressBar)) {\n return\n }\n this.progressBar = new ProgressBar(':current/:total steps [:bar] ', {\n clear: true,\n incomplete: ' ',\n stream: this.stream,\n total: this.numberOfSteps,\n width: valueOrDefault((this.stream as TtyWriteStream).columns, 80),\n })\n }\n\n logProgress({\n testStepId,\n testCaseStartedId,\n }: messages.TestStepFinished): void {\n const { testCase } =\n this.eventDataCollector.getTestCaseAttempt(testCaseStartedId)\n const testStep = testCase.testSteps.find((s) => s.id === testStepId)\n if (doesHaveValue(testStep.pickleStepId)) {\n this.progressBar.tick()\n }\n }\n\n logUndefinedParametertype(\n parameterType: messages.UndefinedParameterType\n ): void {\n this.log(\n `Undefined parameter type: ${formatUndefinedParameterType(\n parameterType\n )}\\n`\n )\n }\n\n logErrorIfNeeded(testCaseFinished: messages.TestCaseFinished): void {\n const { worstTestStepResult } = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n if (isIssue(worstTestStepResult)) {\n this.issueCount += 1\n const testCaseAttempt = this.eventDataCollector.getTestCaseAttempt(\n testCaseFinished.testCaseStartedId\n )\n this.progressBar.interrupt(\n formatIssue({\n colorFns: this.colorFns,\n number: this.issueCount,\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n printAttachments: this.printAttachments,\n })\n )\n if (testCaseFinished.willBeRetried) {\n const stepsToRetry = testCaseAttempt.pickle.steps.length\n this.progressBar.tick(-stepsToRetry)\n }\n }\n }\n\n logSummary(testRunFinished: messages.TestRunFinished): void {\n const testRunDuration = durationBetweenTimestamps(\n this.testRunStarted.timestamp,\n testRunFinished.timestamp\n )\n this.log(\n formatSummary({\n colorFns: this.colorFns,\n testCaseAttempts: this.eventDataCollector.getTestCaseAttempts(),\n testRunDuration,\n })\n )\n }\n\n parseEnvelope(envelope: messages.Envelope): void {\n if (doesHaveValue(envelope.undefinedParameterType)) {\n this.logUndefinedParametertype(envelope.undefinedParameterType)\n } else if (doesHaveValue(envelope.testCase)) {\n this.incrementStepCount(envelope.testCase.pickleId)\n } else if (doesHaveValue(envelope.testStepStarted)) {\n this.initializeProgressBar()\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n } else if (doesHaveValue(envelope.testCaseFinished)) {\n this.logErrorIfNeeded(envelope.testCaseFinished)\n } else if (doesHaveValue(envelope.testRunStarted)) {\n this.testRunStarted = envelope.testRunStarted\n } else if (doesHaveValue(envelope.testRunFinished)) {\n this.logSummary(envelope.testRunFinished)\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import SummaryFormatter from './summary_formatter';
|
|
2
|
+
import { IFormatterOptions } from './index';
|
|
3
|
+
import * as messages from '@cucumber/messages';
|
|
4
|
+
import ITestStepFinished = messages.TestStepFinished;
|
|
5
|
+
export default class ProgressFormatter extends SummaryFormatter {
|
|
6
|
+
static readonly documentation: string;
|
|
7
|
+
constructor(options: IFormatterOptions);
|
|
8
|
+
logProgress({ testStepResult: { status } }: ITestStepFinished): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const summary_formatter_1 = __importDefault(require("./summary_formatter"));
|
|
30
|
+
const value_checker_1 = require("../value_checker");
|
|
31
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
32
|
+
const STATUS_CHARACTER_MAPPING = new Map([
|
|
33
|
+
[messages.TestStepResultStatus.AMBIGUOUS, 'A'],
|
|
34
|
+
[messages.TestStepResultStatus.FAILED, 'F'],
|
|
35
|
+
[messages.TestStepResultStatus.PASSED, '.'],
|
|
36
|
+
[messages.TestStepResultStatus.PENDING, 'P'],
|
|
37
|
+
[messages.TestStepResultStatus.SKIPPED, '-'],
|
|
38
|
+
[messages.TestStepResultStatus.UNDEFINED, 'U'],
|
|
39
|
+
]);
|
|
40
|
+
class ProgressFormatter extends summary_formatter_1.default {
|
|
41
|
+
constructor(options) {
|
|
42
|
+
options.eventBroadcaster.on('envelope', (envelope) => {
|
|
43
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
44
|
+
this.log('\n\n');
|
|
45
|
+
}
|
|
46
|
+
else if ((0, value_checker_1.doesHaveValue)(envelope.testStepFinished)) {
|
|
47
|
+
this.logProgress(envelope.testStepFinished);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
super(options);
|
|
51
|
+
}
|
|
52
|
+
logProgress({ testStepResult: { status } }) {
|
|
53
|
+
const character = this.colorFns.forStatus(status)(STATUS_CHARACTER_MAPPING.get(status));
|
|
54
|
+
this.log(character);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = ProgressFormatter;
|
|
58
|
+
ProgressFormatter.documentation = 'Prints one character per scenario.';
|
|
59
|
+
//# sourceMappingURL=progress_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress_formatter.js","sourceRoot":"","sources":["../../src/formatter/progress_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4EAAkD;AAClD,oDAAgD;AAEhD,6DAA8C;AAI9C,MAAM,wBAAwB,GAC5B,IAAI,GAAG,CAAC;IACN,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;IAC9C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC;IAC5C,CAAC,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAAE,GAAG,CAAC;CAC/C,CAAC,CAAA;AAEJ,MAAqB,iBAAkB,SAAQ,2BAAgB;IAI7D,YAAY,OAA0B;QACpC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAAmB,EAAE,EAAE;YAC9D,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;aACjB;iBAAM,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE;gBACnD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAA;aAC5C;QACH,CAAC,CAAC,CAAA;QACF,KAAK,CAAC,OAAO,CAAC,CAAA;IAChB,CAAC;IAED,WAAW,CAAC,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,EAAqB;QAC3D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,CAC/C,wBAAwB,CAAC,GAAG,CAAC,MAAM,CAAC,CACrC,CAAA;QACD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACrB,CAAC;;AApBH,oCAqBC;AApBwB,+BAAa,GAClC,oCAAoC,CAAA","sourcesContent":["import SummaryFormatter from './summary_formatter'\nimport { doesHaveValue } from '../value_checker'\nimport { IFormatterOptions } from './index'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\nimport ITestStepFinished = messages.TestStepFinished\n\nconst STATUS_CHARACTER_MAPPING: Map<messages.TestStepResultStatus, string> =\n new Map([\n [messages.TestStepResultStatus.AMBIGUOUS, 'A'],\n [messages.TestStepResultStatus.FAILED, 'F'],\n [messages.TestStepResultStatus.PASSED, '.'],\n [messages.TestStepResultStatus.PENDING, 'P'],\n [messages.TestStepResultStatus.SKIPPED, '-'],\n [messages.TestStepResultStatus.UNDEFINED, 'U'],\n ])\n\nexport default class ProgressFormatter extends SummaryFormatter {\n public static readonly documentation: string =\n 'Prints one character per scenario.'\n\n constructor(options: IFormatterOptions) {\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.log('\\n\\n')\n } else if (doesHaveValue(envelope.testStepFinished)) {\n this.logProgress(envelope.testStepFinished)\n }\n })\n super(options)\n }\n\n logProgress({ testStepResult: { status } }: ITestStepFinished): void {\n const character = this.colorFns.forStatus(status)(\n STATUS_CHARACTER_MAPPING.get(status)\n )\n this.log(character)\n }\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Formatter, { IFormatterOptions } from './';
|
|
2
|
+
interface UriToLinesMap {
|
|
3
|
+
[uri: string]: number[];
|
|
4
|
+
}
|
|
5
|
+
export default class RerunFormatter extends Formatter {
|
|
6
|
+
protected readonly separator: string;
|
|
7
|
+
static readonly documentation: string;
|
|
8
|
+
constructor(options: IFormatterOptions);
|
|
9
|
+
getFailureMap(): UriToLinesMap;
|
|
10
|
+
formatFailedTestCases(): string;
|
|
11
|
+
logFailedTestCases(): void;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const _1 = __importDefault(require("./"));
|
|
30
|
+
const gherkin_document_parser_1 = require("./helpers/gherkin_document_parser");
|
|
31
|
+
const value_checker_1 = require("../value_checker");
|
|
32
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
33
|
+
const DEFAULT_SEPARATOR = '\n';
|
|
34
|
+
function isFailedAttempt(worstTestStepResult) {
|
|
35
|
+
return worstTestStepResult.status !== messages.TestStepResultStatus.PASSED;
|
|
36
|
+
}
|
|
37
|
+
class RerunFormatter extends _1.default {
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super(options);
|
|
40
|
+
options.eventBroadcaster.on('envelope', (envelope) => {
|
|
41
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
42
|
+
this.logFailedTestCases();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const rerunOptions = (0, value_checker_1.valueOrDefault)(options.parsedArgvOptions.rerun, {});
|
|
46
|
+
this.separator = (0, value_checker_1.valueOrDefault)(rerunOptions.separator, DEFAULT_SEPARATOR);
|
|
47
|
+
}
|
|
48
|
+
getFailureMap() {
|
|
49
|
+
const mapping = {};
|
|
50
|
+
this.eventDataCollector
|
|
51
|
+
.getTestCaseAttempts()
|
|
52
|
+
.forEach(({ gherkinDocument, pickle, worstTestStepResult, willBeRetried }) => {
|
|
53
|
+
if (isFailedAttempt(worstTestStepResult) && !willBeRetried) {
|
|
54
|
+
const relativeUri = pickle.uri;
|
|
55
|
+
const line = (0, gherkin_document_parser_1.getGherkinScenarioLocationMap)(gherkinDocument)[pickle.astNodeIds[pickle.astNodeIds.length - 1]].line;
|
|
56
|
+
if ((0, value_checker_1.doesNotHaveValue)(mapping[relativeUri])) {
|
|
57
|
+
mapping[relativeUri] = [];
|
|
58
|
+
}
|
|
59
|
+
mapping[relativeUri].push(line);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
return mapping;
|
|
63
|
+
}
|
|
64
|
+
formatFailedTestCases() {
|
|
65
|
+
const mapping = this.getFailureMap();
|
|
66
|
+
return Object.keys(mapping)
|
|
67
|
+
.map((uri) => {
|
|
68
|
+
const lines = mapping[uri];
|
|
69
|
+
return `${uri}:${lines.join(':')}`;
|
|
70
|
+
})
|
|
71
|
+
.join(this.separator);
|
|
72
|
+
}
|
|
73
|
+
logFailedTestCases() {
|
|
74
|
+
const failedTestCases = this.formatFailedTestCases();
|
|
75
|
+
this.log(failedTestCases);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.default = RerunFormatter;
|
|
79
|
+
RerunFormatter.documentation = 'Prints failing files with line numbers.';
|
|
80
|
+
//# sourceMappingURL=rerun_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rerun_formatter.js","sourceRoot":"","sources":["../../src/formatter/rerun_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAiD;AACjD,+EAAiF;AACjF,oDAIyB;AACzB,6DAA8C;AAE9C,MAAM,iBAAiB,GAAG,IAAI,CAAA;AAM9B,SAAS,eAAe,CAAC,mBAA4C;IACnE,OAAO,mBAAmB,CAAC,MAAM,KAAK,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAA;AAC5E,CAAC;AAED,MAAqB,cAAe,SAAQ,UAAS;IAKnD,YAAY,OAA0B;QACpC,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,CAAC,QAA2B,EAAE,EAAE;YACtE,IAAI,IAAA,6BAAa,EAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;gBAC3C,IAAI,CAAC,kBAAkB,EAAE,CAAA;aAC1B;QACH,CAAC,CAAC,CAAA;QACF,MAAM,YAAY,GAAG,IAAA,8BAAc,EAAC,O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AA;IACzB,CAAC;IAED,kBAAkB;QAChB,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAA;QACpD,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;IAC3B,CAAC;;AArDH,iCAsDC;AApDwB,4BAAa,GAClC,yCAAyC,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport { getGherkinScenarioLocationMap } from './helpers/gherkin_document_parser'\nimport {\n doesHaveValue,\n doesNotHaveValue,\n valueOrDefault,\n} from '../value_checker'\nimport * as messages from '@cucumber/messages'\n\nconst DEFAULT_SEPARATOR = '\\n'\n\ninterface UriToLinesMap {\n [uri: string]: number[]\n}\n\nfunction isFailedAttempt(worstTestStepResult: messages.TestStepResult) {\n return worstTestStepResult.status !== messages.TestStepResultStatus.PASSED\n}\n\nexport default class RerunFormatter extends Formatter {\n protected readonly separator: string\n public static readonly documentation: string =\n 'Prints failing files with line numbers.'\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: messages.Envelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logFailedTestCases()\n }\n })\n const rerunOptions = valueOrDefault(options.parsedArgvOptions.rerun, {})\n this.separator = valueOrDefault(rerunOptions.separator, DEFAULT_SEPARATOR)\n }\n\n getFailureMap(): UriToLinesMap {\n const mapping: UriToLinesMap = {}\n this.eventDataCollector\n .getTestCaseAttempts()\n .forEach(\n ({ gherkinDocument, pickle, worstTestStepResult, willBeRetried }) => {\n if (isFailedAttempt(worstTestStepResult) && !willBeRetried) {\n const relativeUri = pickle.uri\n const line =\n getGherkinScenarioLocationMap(gherkinDocument)[\n pickle.astNodeIds[pickle.astNodeIds.length - 1]\n ].line\n if (doesNotHaveValue(mapping[relativeUri])) {\n mapping[relativeUri] = []\n }\n mapping[relativeUri].push(line)\n }\n }\n )\n\n return mapping\n }\n\n formatFailedTestCases(): string {\n const mapping = this.getFailureMap()\n\n return Object.keys(mapping)\n .map((uri) => {\n const lines = mapping[uri]\n return `${uri}:${lines.join(':')}`\n })\n .join(this.separator)\n }\n\n logFailedTestCases(): void {\n const failedTestCases = this.formatFailedTestCases()\n this.log(failedTestCases)\n }\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const _1 = __importDefault(require("./"));
|
|
30
|
+
const helpers_1 = require("./helpers");
|
|
31
|
+
const value_checker_1 = require("../value_checker");
|
|
32
|
+
const messages = __importStar(require("@cucumber/messages"));
|
|
33
|
+
class SnippetsFormatter extends _1.default {
|
|
34
|
+
constructor(options) {
|
|
35
|
+
super(options);
|
|
36
|
+
options.eventBroadcaster.on('envelope', (envelope) => {
|
|
37
|
+
if ((0, value_checker_1.doesHaveValue)(envelope.testRunFinished)) {
|
|
38
|
+
this.logSnippets();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
logSnippets() {
|
|
43
|
+
const snippets = [];
|
|
44
|
+
this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {
|
|
45
|
+
const parsed = (0, helpers_1.parseTestCaseAttempt)({
|
|
46
|
+
snippetBuilder: this.snippetBuilder,
|
|
47
|
+
supportCodeLibrary: this.supportCodeLibrary,
|
|
48
|
+
testCaseAttempt,
|
|
49
|
+
});
|
|
50
|
+
parsed.testSteps.forEach((testStep) => {
|
|
51
|
+
if (testStep.result.status === messages.TestStepResultStatus.UNDEFINED) {
|
|
52
|
+
snippets.push(testStep.snippet);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
this.log(snippets.join('\n\n'));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.default = SnippetsFormatter;
|
|
60
|
+
SnippetsFormatter.documentation = "The Snippets Formatter doesn't output anything regarding the test run; it just prints snippets to implement any undefined steps";
|
|
61
|
+
//# sourceMappingURL=snippets_formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snippets_formatter.js","sourceRoot":"","sources":["../../src/formatter/snippets_formatter.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAiD;AACjD,uCAAgD;AAChD,oDAAgD;AAChD,6DAA8C;AAG9C,MAAqB,iBAAkB,SAAQ,UAAS;IAItD,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;gBAC3C,IAAI,CAAC,WAAW,EAAE,CAAA;aACnB;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,WAAW;QACT,MAAM,QAAQ,GAAa,EAAE,CAAA;QAC7B,IAAI,CAAC,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,EAAE;YACxE,MAAM,MAAM,GAAG,IAAA,8BAAoB,EAAC;gBAClC,cAAc,EAAE,IAAI,CAAC,cAAc;gBACnC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;gBAC3C,eAAe;aAChB,CAAC,CAAA;YACF,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;gBACpC,IACE,QAAQ,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,oBAAoB,CAAC,SAAS,EAClE;oBACA,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;iBAChC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;IACjC,CAAC;;AA9BH,oCA+BC;AA9BwB,+BAAa,GAClC,iIAAiI,CAAA","sourcesContent":["import Formatter, { IFormatterOptions } from './'\nimport { parseTestCaseAttempt } from './helpers'\nimport { doesHaveValue } from '../value_checker'\nimport * as messages from '@cucumber/messages'\nimport IEnvelope = messages.Envelope\n\nexport default class SnippetsFormatter extends Formatter {\n public static readonly documentation: string =\n \"The Snippets Formatter doesn't output anything regarding the test run; it just prints snippets to implement any undefined steps\"\n\n constructor(options: IFormatterOptions) {\n super(options)\n options.eventBroadcaster.on('envelope', (envelope: IEnvelope) => {\n if (doesHaveValue(envelope.testRunFinished)) {\n this.logSnippets()\n }\n })\n }\n\n logSnippets(): void {\n const snippets: string[] = []\n this.eventDataCollector.getTestCaseAttempts().forEach((testCaseAttempt) => {\n const parsed = parseTestCaseAttempt({\n snippetBuilder: this.snippetBuilder,\n supportCodeLibrary: this.supportCodeLibrary,\n testCaseAttempt,\n })\n parsed.testSteps.forEach((testStep) => {\n if (\n testStep.result.status === messages.TestStepResultStatus.UNDEFINED\n ) {\n snippets.push(testStep.snippet)\n }\n })\n })\n this.log(snippets.join('\\n\\n'))\n }\n}\n"]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { KeywordType } from '../helpers';
|
|
2
|
+
import { ISnippetSnytax } from './snippet_syntax';
|
|
3
|
+
import { ParameterTypeRegistry } from '@cucumber/cucumber-expressions';
|
|
4
|
+
import * as messages from '@cucumber/messages';
|
|
5
|
+
export interface INewStepDefinitionSnippetBuilderOptions {
|
|
6
|
+
snippetSyntax: ISnippetSnytax;
|
|
7
|
+
parameterTypeRegistry: ParameterTypeRegistry;
|
|
8
|
+
}
|
|
9
|
+
export interface IBuildRequest {
|
|
10
|
+
keywordType: KeywordType;
|
|
11
|
+
pickleStep: messages.PickleStep;
|
|
12
|
+
}
|
|
13
|
+
export default class StepDefinitionSnippetBuilder {
|
|
14
|
+
private readonly snippetSyntax;
|
|
15
|
+
private readonly cucumberExpressionGenerator;
|
|
16
|
+
constructor({ snippetSyntax, parameterTypeRegistry, }: INewStepDefinitionSnippetBuilderOptions);
|
|
17
|
+
build({ keywordType, pickleStep }: IBuildRequest): string;
|
|
18
|
+
getFunctionName(keywordType: KeywordType): string;
|
|
19
|
+
getStepParameterNames(step: messages.PickleStep): string[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const helpers_1 = require("../helpers");
|
|
4
|
+
const step_arguments_1 = require("../../step_arguments");
|
|
5
|
+
const cucumber_expressions_1 = require("@cucumber/cucumber-expressions");
|
|
6
|
+
const value_checker_1 = require("../../value_checker");
|
|
7
|
+
class StepDefinitionSnippetBuilder {
|
|
8
|
+
constructor({ snippetSyntax, parameterTypeRegistry, }) {
|
|
9
|
+
this.snippetSyntax = snippetSyntax;
|
|
10
|
+
this.cucumberExpressionGenerator = new cucumber_expressions_1.CucumberExpressionGenerator(() => parameterTypeRegistry.parameterTypes);
|
|
11
|
+
}
|
|
12
|
+
build({ keywordType, pickleStep }) {
|
|
13
|
+
const comment = 'Write code here that turns the phrase above into concrete actions';
|
|
14
|
+
const functionName = this.getFunctionName(keywordType);
|
|
15
|
+
const generatedExpressions = this.cucumberExpressionGenerator.generateExpressions(pickleStep.text);
|
|
16
|
+
const stepParameterNames = this.getStepParameterNames(pickleStep);
|
|
17
|
+
return this.snippetSyntax.build({
|
|
18
|
+
comment,
|
|
19
|
+
functionName,
|
|
20
|
+
generatedExpressions,
|
|
21
|
+
stepParameterNames,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
getFunctionName(keywordType) {
|
|
25
|
+
switch (keywordType) {
|
|
26
|
+
case helpers_1.KeywordType.Event:
|
|
27
|
+
return 'When';
|
|
28
|
+
case helpers_1.KeywordType.Outcome:
|
|
29
|
+
return 'Then';
|
|
30
|
+
case helpers_1.KeywordType.Precondition:
|
|
31
|
+
return 'Given';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
getStepParameterNames(step) {
|
|
35
|
+
if ((0, value_checker_1.doesHaveValue)(step.argument)) {
|
|
36
|
+
const argumentName = (0, step_arguments_1.parseStepArgument)(step.argument, {
|
|
37
|
+
dataTable: () => 'dataTable',
|
|
38
|
+
docString: () => 'docString',
|
|
39
|
+
});
|
|
40
|
+
return [argumentName];
|
|
41
|
+
}
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = StepDefinitionSnippetBuilder;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/formatter/step_definition_snippet_builder/index.ts"],"names":[],"mappings":";;AAAA,wCAAwC;AACxC,yDAAwD;AAExD,yEAGuC;AAEvC,uDAAmD;AAYnD,MAAqB,4BAA4B;IAI/C,YAAY,EACV,aAAa,EACb,qBAAqB,GACmB;QACxC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,kDAA2B,CAChE,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAC3C,CAAA;IACH,CAAC;IAED,KAAK,CAAC,EAAE,WAAW,EAAE,UAAU,EAAiB;QAC9C,MAAM,OAAO,GACX,mEAAmE,CAAA;QACrE,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;QACtD,MAAM,oBAAoB,GACxB,IAAI,CAAC,2BAA2B,CAAC,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAA;QACjE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;YAC9B,OAAO;YACP,YAAY;YACZ,oBAAoB;YACpB,kBAAkB;SACnB,CAAC,CAAA;IACJ,CAAC;IAED,eAAe,CAAC,WAAwB;QACtC,QAAQ,WAAW,EAAE;YACnB,KAAK,qBAAW,CAAC,KAAK;gBACpB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,OAAO;gBACtB,OAAO,MAAM,CAAA;YACf,KAAK,qBAAW,CAAC,YAAY;gBAC3B,OAAO,OAAO,CAAA;SACjB;IACH,CAAC;IAED,qBAAqB,CAAC,IAAyB;QAC7C,IAAI,IAAA,6BAAa,EAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;YAChC,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;SACtB;QACD,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAlDD,+CAkDC","sourcesContent":["import { KeywordType } from '../helpers'\nimport { parseStepArgument } from '../../step_arguments'\nimport { ISnippetSnytax } from './snippet_syntax'\nimport {\n CucumberExpressionGenerator,\n ParameterTypeRegistry,\n} from '@cucumber/cucumber-expressions'\nimport * as messages from '@cucumber/messages'\nimport { doesHaveValue } from '../../value_checker'\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 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"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ISnippetSnytax, ISnippetSyntaxBuildOptions, SnippetInterface } from './snippet_syntax';
|
|
2
|
+
export default class JavaScriptSnippetSyntax implements ISnippetSnytax {
|
|
3
|
+
private readonly snippetInterface;
|
|
4
|
+
constructor(snippetInterface: SnippetInterface);
|
|
5
|
+
build({ comment, generatedExpressions, functionName, stepParameterNames, }: ISnippetSyntaxBuildOptions): string;
|
|
6
|
+
private escapeSpecialCharacters;
|
|
7
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const snippet_syntax_1 = require("./snippet_syntax");
|
|
4
|
+
const CALLBACK_NAME = 'callback';
|
|
5
|
+
class JavaScriptSnippetSyntax {
|
|
6
|
+
constructor(snippetInterface) {
|
|
7
|
+
this.snippetInterface = snippetInterface;
|
|
8
|
+
}
|
|
9
|
+
build({ comment, generatedExpressions, functionName, stepParameterNames, }) {
|
|
10
|
+
let functionKeyword = 'function ';
|
|
11
|
+
if (this.snippetInterface === snippet_syntax_1.SnippetInterface.AsyncAwait) {
|
|
12
|
+
functionKeyword = 'async ' + functionKeyword;
|
|
13
|
+
}
|
|
14
|
+
let implementation;
|
|
15
|
+
if (this.snippetInterface === snippet_syntax_1.SnippetInterface.Callback) {
|
|
16
|
+
implementation = `${CALLBACK_NAME}(null, 'pending');`;
|
|
17
|
+
}
|
|
18
|
+
else if (this.snippetInterface === snippet_syntax_1.SnippetInterface.Promise) {
|
|
19
|
+
implementation = "return Promise.resolve('pending');";
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
implementation = "return 'pending';";
|
|
23
|
+
}
|
|
24
|
+
const definitionChoices = generatedExpressions.map((generatedExpression, index) => {
|
|
25
|
+
const prefix = index === 0 ? '' : '// ';
|
|
26
|
+
const allParameterNames = generatedExpression.parameterNames.concat(stepParameterNames);
|
|
27
|
+
if (this.snippetInterface === snippet_syntax_1.SnippetInterface.Callback) {
|
|
28
|
+
allParameterNames.push(CALLBACK_NAME);
|
|
29
|
+
}
|
|
30
|
+
return `${prefix + functionName}('${this.escapeSpecialCharacters(generatedExpression)}', ${functionKeyword}(${allParameterNames.join(', ')}) {\n`;
|
|
31
|
+
});
|
|
32
|
+
return (`${definitionChoices.join('')} // ${comment}\n` +
|
|
33
|
+
` ${implementation}\n` +
|
|
34
|
+
'});');
|
|
35
|
+
}
|
|
36
|
+
escapeSpecialCharacters(generatedExpression) {
|
|
37
|
+
let source = generatedExpression.source;
|
|
38
|
+
// double up any backslashes because we're in a javascript string
|
|
39
|
+
source = source.replace(/\\/g, '\\\\');
|
|
40
|
+
// escape any single quotes because that's our quote delimiter
|
|
41
|
+
source = source.replace(/'/g, "\\'");
|
|
42
|
+
return source;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.default = JavaScriptSnippetSyntax;
|
|
46
|
+
//# sourceMappingURL=javascript_snippet_syntax.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;IAG1C,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;YACzD,eAAe,GAAG,QAAQ,GAAG,eAAe,CAAA;SAC7C;QAED,IAAI,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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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { GeneratedExpression } from '@cucumber/cucumber-expressions';
|
|
2
|
+
export declare enum SnippetInterface {
|
|
3
|
+
AsyncAwait = "async-await",
|
|
4
|
+
Callback = "callback",
|
|
5
|
+
Promise = "promise",
|
|
6
|
+
Synchronous = "synchronous"
|
|
7
|
+
}
|
|
8
|
+
export interface ISnippetSyntaxBuildOptions {
|
|
9
|
+
comment: string;
|
|
10
|
+
functionName: string;
|
|
11
|
+
generatedExpressions: readonly GeneratedExpression[];
|
|
12
|
+
stepParameterNames: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ISnippetSnytax {
|
|
15
|
+
build: (options: ISnippetSyntaxBuildOptions) => string;
|
|
16
|
+
}
|