cucumber 2.99.0 → 3.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.
- checksums.yaml +4 -4
- data/.cucumberproignore +6 -0
- data/.gitattributes +32 -0
- data/.github/ISSUE_TEMPLATE.md +1 -1
- data/.github/PULL_REQUEST_TEMPLATE.md +1 -0
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +991 -0
- data/.travis.yml +56 -10
- data/{History.md → CHANGELOG.md} +166 -32
- data/CONTRIBUTING.md +21 -1
- data/Gemfile +18 -5
- data/README.md +13 -4
- data/Rakefile +12 -2
- data/appveyor.yml +27 -0
- data/bin/cucumber +2 -1
- data/cucumber.gemspec +15 -10
- data/cucumber.yml +10 -11
- data/examples/i18n/Rakefile +1 -1
- data/examples/i18n/ar/features/step_definitions/calculator_steps.rb +8 -3
- data/examples/i18n/ar/lib/calculator.rb +2 -2
- data/examples/i18n/bg/features/step_definitions/calculator_steps.rb +6 -6
- data/examples/i18n/bg/features/support/env.rb +6 -1
- data/examples/i18n/bg/lib/calculator.rb +2 -1
- data/examples/i18n/ca/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ca/lib/calculadora.rb +2 -2
- data/examples/i18n/cs/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/cs/lib/calculator.rb +3 -3
- data/examples/i18n/da/features/step_definitions/lommeregner_steps.rb +10 -5
- data/examples/i18n/da/lib/lommeregner.rb +2 -2
- data/examples/i18n/de/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/de/lib/calculator.rb +2 -2
- data/examples/i18n/el/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/el/lib/calculator.rb +2 -2
- data/examples/i18n/en/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/en/lib/calculator.rb +2 -2
- data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +4 -4
- data/examples/i18n/en-lol/features/support/env.rb +6 -2
- data/examples/i18n/en-lol/lib/basket.rb +2 -2
- data/examples/i18n/en-lol/lib/belly.rb +2 -2
- data/examples/i18n/eo/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/eo/lib/calculator.rb +2 -2
- data/examples/i18n/es/features/step_definitions/calculador_steps.rb +10 -5
- data/examples/i18n/es/lib/calculador.rb +2 -2
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +10 -5
- data/examples/i18n/et/lib/kalkulaator.rb +3 -3
- data/examples/i18n/fi/features/step_definitions/laskin_steps.rb +9 -4
- data/examples/i18n/fi/lib/laskin.rb +1 -1
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +8 -8
- data/examples/i18n/fr/features/support/env.rb +7 -2
- data/examples/i18n/fr/lib/calculatrice.rb +2 -2
- data/examples/i18n/he/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/he/lib/calculator.rb +1 -1
- data/examples/i18n/hi/features/step_definitions/calculator_steps.rb +9 -4
- data/examples/i18n/hi/lib/calculator.rb +1 -1
- data/examples/i18n/ht/features/step_definitions/kalkilatris_steps.rb +9 -5
- data/examples/i18n/ht/lib/kalkilatris.rb +2 -2
- data/examples/i18n/hu/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/hu/lib/calculator.rb +1 -1
- data/examples/i18n/id/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/id/lib/calculator.rb +2 -2
- data/examples/i18n/it/features/step_definitions/calcolatrice_steps.rb +10 -5
- data/examples/i18n/it/lib/calcolatrice.rb +3 -3
- data/examples/i18n/ja/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/ja/features/support/env.rb +7 -2
- data/examples/i18n/ja/lib/calculator.rb +2 -2
- data/examples/i18n/ko/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/ko/lib/calculator.rb +2 -2
- data/examples/i18n/lt/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lt/lib/calculator.rb +2 -2
- data/examples/i18n/lv/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/lv/lib/calculator.rb +2 -2
- data/examples/i18n/no/features/step_definitions/kalkulator_steps.rb +3 -3
- data/examples/i18n/no/features/support/env.rb +7 -2
- data/examples/i18n/no/lib/kalkulator.rb +2 -2
- data/examples/i18n/pl/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/pl/features/support/env.rb +6 -1
- data/examples/i18n/pl/lib/calculator.rb +2 -2
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +3 -3
- data/examples/i18n/pt/features/support/env.rb +7 -2
- data/examples/i18n/pt/lib/calculadora.rb +1 -1
- data/examples/i18n/ro/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/ro/lib/calculator.rb +1 -1
- data/examples/i18n/ru/features/step_definitions/calculator_steps.rb +5 -5
- data/examples/i18n/ru/features/support/env.rb +6 -1
- data/examples/i18n/ru/lib/calculator.rb +2 -1
- data/examples/i18n/sk/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sk/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Cyrl/features/step_definitions/calculator_steps.rb +3 -3
- data/examples/i18n/sr-Cyrl/features/support/env.rb +7 -2
- data/examples/i18n/sr-Cyrl/lib/calculator.rb +2 -2
- data/examples/i18n/sr-Latn/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/sr-Latn/lib/calculator.rb +2 -2
- data/examples/i18n/sv/features/step_definitions/kalkulator_steps.rb +9 -4
- data/examples/i18n/sv/lib/kalkulator.rb +2 -2
- data/examples/i18n/tr/features/step_definitions/hesap_makinesi_adimlari.rb +10 -5
- data/examples/i18n/tr/lib/hesap_makinesi.rb +2 -2
- data/examples/i18n/uk/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uk/features/support/env.rb +6 -1
- data/examples/i18n/uk/lib/calculator.rb +2 -1
- data/examples/i18n/uz/features/step_definitions/calculator_steps.rb +4 -4
- data/examples/i18n/uz/features/support/env.rb +6 -1
- data/examples/i18n/uz/lib/calculator.rb +2 -1
- data/examples/i18n/zh-CN/features/step_definitions/calculator_steps.rb +11 -6
- data/examples/i18n/zh-CN/lib/calculator.rb +2 -2
- data/examples/i18n/zh-TW/features/step_definitions/calculator_steps.rb +10 -5
- data/examples/i18n/zh-TW/lib/calculator.rb +2 -2
- data/examples/rspec_doubles/features/step_definitions/calvin_steps.rb +3 -3
- data/examples/sinatra/features/step_definitions/add_steps.rb +4 -4
- data/examples/sinatra/features/support/env.rb +6 -1
- data/examples/tcl/features/step_definitions/fib_steps.rb +2 -2
- data/examples/tcl/features/support/env.rb +2 -1
- data/examples/test_unit/features/step_definitions/test_unit_steps.rb +4 -4
- data/examples/watir/features/step_definitions/search_steps.rb +6 -5
- data/examples/watir/features/support/env.rb +5 -1
- data/examples/watir/features/support/screenshots.rb +5 -5
- data/features/docs/api/list_step_defs_as_json.feature +21 -7
- data/features/docs/api/listen_for_events.feature +9 -8
- data/features/docs/api/run_cli_main_with_existing_runtime.feature +1 -0
- data/features/docs/cli/dry_run.feature +3 -0
- data/features/docs/cli/execute_with_tag_filter.feature +8 -6
- data/features/docs/cli/fail_fast.feature +2 -0
- data/features/docs/cli/help.feature +8 -0
- data/features/docs/{gherkin/language_help.feature → cli/i18n.feature} +6 -6
- data/features/docs/cli/randomize.feature +2 -2
- data/features/docs/cli/retry_failing_tests.feature +75 -15
- data/features/docs/cli/run_scenarios_matching_name.feature +1 -0
- data/features/docs/cli/specifying_multiple_formatters.feature +3 -0
- data/features/docs/cli/strict_mode.feature +6 -0
- data/features/docs/defining_steps/ambiguous_steps.feature +89 -0
- data/features/docs/defining_steps/nested_steps.feature +5 -1
- data/features/docs/defining_steps/nested_steps_i18n.feature +3 -0
- data/features/docs/defining_steps/nested_steps_with_second_arg.feature +2 -0
- data/features/docs/defining_steps/printing_messages.feature +1 -2
- data/features/docs/defining_steps/skip_scenario.feature +1 -34
- data/features/docs/defining_steps/snippets.feature +18 -18
- data/features/docs/events/gherkin_source_read_event.feature +43 -0
- data/features/docs/events/step_activated_event.feature +36 -0
- data/features/docs/events/step_definition_registered_event.feature +29 -0
- data/features/docs/events/test_case_finished_event.feature +35 -0
- data/features/docs/events/test_case_started_event.feature +54 -0
- data/features/docs/events/test_run_finished_event.feature +40 -0
- data/features/docs/events/test_run_started_event.feature +41 -0
- data/features/docs/events/test_step_finished_event.feature +47 -0
- data/features/docs/events/test_step_started_event.feature +43 -0
- data/features/docs/exception_in_after_hook.feature +3 -2
- data/features/docs/exception_in_after_step_hook.feature +2 -0
- data/features/docs/exception_in_around_hook.feature +2 -0
- data/features/docs/exception_in_before_hook.feature +3 -1
- data/features/docs/extending_cucumber/custom_formatter.feature +12 -48
- data/features/docs/formatters/json_formatter.feature +4 -4
- data/features/docs/formatters/junit_formatter.feature +7 -6
- data/features/docs/formatters/pretty_formatter.feature +1 -0
- data/features/docs/formatters/progress_formatter.feature +1 -0
- data/features/docs/formatters/rerun_formatter.feature +2 -0
- data/features/docs/formatters/summary_formatter.feature +35 -0
- data/features/docs/formatters/usage_formatter.feature +3 -0
- data/features/docs/getting_started.feature +2 -1
- data/features/docs/gherkin/background.feature +5 -5
- data/features/docs/gherkin/doc_strings.feature +2 -0
- data/features/docs/gherkin/expand_option_for_outlines.feature +1 -0
- data/features/docs/gherkin/outlines.feature +6 -4
- data/features/docs/gherkin/unicode_table.feature +2 -1
- data/features/docs/gherkin/using_descriptions.feature +1 -0
- data/features/docs/gherkin/using_star_notation.feature +1 -1
- data/features/docs/post_configuration_hook.feature +1 -17
- data/features/docs/rake_task.feature +5 -0
- data/features/docs/raketask.feature +3 -1
- data/features/docs/work_in_progress.feature +5 -2
- data/features/docs/writing_support_code/after_step_hooks.feature +3 -1
- data/features/docs/writing_support_code/around_hooks.feature +6 -0
- data/features/docs/writing_support_code/before_hook.feature +1 -0
- data/features/docs/writing_support_code/hook_order.feature +3 -1
- data/features/docs/writing_support_code/parameter_types.feature +53 -0
- data/features/docs/writing_support_code/tagged_hooks.feature +1 -1
- data/features/docs/writing_support_code/world.feature +129 -0
- data/features/lib/step_definitions/aruba_steps.rb +5 -10
- data/features/lib/step_definitions/cli_steps.rb +4 -0
- data/features/lib/step_definitions/cucumber_steps.rb +9 -12
- data/features/lib/step_definitions/iso-8859-1_steps.rb +9 -5
- data/features/lib/step_definitions/json_steps.rb +2 -1
- data/features/lib/step_definitions/junit_steps.rb +2 -1
- data/features/lib/step_definitions/language_steps.rb +3 -2
- data/features/lib/step_definitions/profile_steps.rb +7 -6
- data/features/lib/step_definitions/retry_steps.rb +33 -13
- data/features/lib/step_definitions/ruby_steps.rb +2 -1
- data/features/lib/support/env.rb +3 -2
- data/features/lib/support/fake_wire_server.rb +17 -3
- data/features/lib/support/feature_factory.rb +2 -1
- data/features/lib/support/normalise_output.rb +14 -12
- data/features/lib/support/parameter_types.rb +5 -0
- data/gem_tasks/contributors.rake +10 -6
- data/gem_tasks/cov.rake +1 -0
- data/gem_tasks/downloads.rb +1 -0
- data/gem_tasks/environment.rake +2 -5
- data/gem_tasks/examples.rake +3 -2
- data/gem_tasks/fix_cr_lf.rake +19 -7
- data/gem_tasks/flog.rake +4 -3
- data/gem_tasks/rspec.rake +2 -1
- data/gem_tasks/sass.rake +2 -1
- data/lib/autotest/cucumber.rb +1 -0
- data/lib/autotest/cucumber_mixin.rb +17 -16
- data/lib/autotest/cucumber_rails.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec.rb +1 -0
- data/lib/autotest/cucumber_rails_rspec2.rb +1 -0
- data/lib/autotest/cucumber_rspec.rb +1 -0
- data/lib/autotest/cucumber_rspec2.rb +1 -0
- data/lib/autotest/discover.rb +3 -2
- data/lib/cucumber/cli/configuration.rb +12 -21
- data/lib/cucumber/cli/main.rb +8 -7
- data/lib/cucumber/cli/options.rb +341 -217
- data/lib/cucumber/cli/profile_loader.rb +26 -21
- data/lib/cucumber/cli/rerun_file.rb +1 -0
- data/lib/cucumber/configuration.rb +54 -37
- data/lib/cucumber/constantize.rb +2 -1
- data/lib/cucumber/core_ext/string.rb +2 -1
- data/lib/cucumber/deprecate.rb +4 -3
- data/lib/cucumber/encoding.rb +1 -0
- data/lib/cucumber/errors.rb +3 -1
- data/lib/cucumber/events/gherkin_source_read.rb +17 -0
- data/lib/cucumber/events/{step_match.rb → step_activated.rb} +5 -2
- data/lib/cucumber/events/step_definition_registered.rb +24 -0
- data/lib/cucumber/events/test_case_finished.rb +18 -0
- data/lib/cucumber/events/test_case_started.rb +15 -0
- data/lib/cucumber/events/test_run_finished.rb +12 -0
- data/lib/cucumber/events/test_run_started.rb +16 -0
- data/lib/cucumber/events/test_step_finished.rb +20 -0
- data/lib/cucumber/events/test_step_started.rb +17 -0
- data/lib/cucumber/events.rb +23 -3
- data/lib/cucumber/file_specs.rb +1 -0
- data/lib/cucumber/filters/activate_steps.rb +8 -3
- data/lib/cucumber/filters/apply_after_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_after_step_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_around_hooks.rb +1 -0
- data/lib/cucumber/filters/apply_before_hooks.rb +1 -0
- data/lib/cucumber/filters/broadcast_test_run_started_event.rb +27 -0
- data/lib/cucumber/filters/gated_receiver.rb +1 -0
- data/lib/cucumber/filters/prepare_world.rb +1 -0
- data/lib/cucumber/filters/quit.rb +1 -0
- data/lib/cucumber/filters/randomizer.rb +1 -0
- data/lib/cucumber/filters/retry.rb +4 -4
- data/lib/cucumber/filters/tag_limits/test_case_index.rb +1 -0
- data/lib/cucumber/filters/tag_limits/verifier.rb +2 -1
- data/lib/cucumber/filters/tag_limits.rb +4 -3
- data/lib/cucumber/filters.rb +3 -0
- data/lib/cucumber/formatter/ansicolor.rb +9 -11
- data/lib/cucumber/formatter/backtrace_filter.rb +21 -8
- data/lib/cucumber/formatter/console.rb +72 -66
- data/lib/cucumber/formatter/console_counts.rb +44 -0
- data/lib/cucumber/formatter/console_issues.rb +58 -0
- data/lib/cucumber/formatter/duration.rb +2 -1
- data/lib/cucumber/formatter/duration_extractor.rb +1 -0
- data/lib/cucumber/formatter/fail_fast.rb +4 -2
- data/lib/cucumber/formatter/fanout.rb +1 -0
- data/lib/cucumber/formatter/hook_query_visitor.rb +1 -0
- data/lib/cucumber/formatter/html.rb +175 -249
- data/lib/cucumber/formatter/html_builder.rb +120 -0
- data/lib/cucumber/formatter/ignore_missing_messages.rb +1 -0
- data/lib/cucumber/formatter/inline-js.js +30 -0
- data/lib/cucumber/formatter/interceptor.rb +3 -2
- data/lib/cucumber/formatter/io.rb +2 -1
- data/lib/cucumber/formatter/json.rb +33 -30
- data/lib/cucumber/formatter/json_pretty.rb +1 -0
- data/lib/cucumber/formatter/junit.rb +26 -24
- data/lib/cucumber/formatter/legacy_api/adapter.rb +81 -69
- data/lib/cucumber/formatter/legacy_api/ast.rb +27 -22
- data/lib/cucumber/formatter/legacy_api/results.rb +7 -8
- data/lib/cucumber/formatter/legacy_api/runtime_facade.rb +1 -0
- data/lib/cucumber/formatter/pretty.rb +24 -18
- data/lib/cucumber/formatter/progress.rb +55 -13
- data/lib/cucumber/formatter/rerun.rb +15 -18
- data/lib/cucumber/formatter/stepdefs.rb +1 -0
- data/lib/cucumber/formatter/steps.rb +2 -1
- data/lib/cucumber/formatter/summary.rb +43 -20
- data/lib/cucumber/formatter/unicode.rb +2 -1
- data/lib/cucumber/formatter/usage.rb +33 -28
- data/lib/cucumber/gherkin/data_table_parser.rb +1 -0
- data/lib/cucumber/gherkin/formatter/ansi_escapes.rb +2 -1
- data/lib/cucumber/gherkin/formatter/escaping.rb +2 -1
- data/lib/cucumber/gherkin/i18n.rb +1 -0
- data/lib/cucumber/gherkin/steps_parser.rb +1 -0
- data/lib/cucumber/{rb_support/rb_dsl.rb → glue/dsl.rb} +41 -30
- data/lib/cucumber/glue/hook.rb +43 -0
- data/lib/cucumber/glue/invoke_in_world.rb +70 -0
- data/lib/cucumber/glue/proto_world.rb +220 -0
- data/lib/cucumber/{rb_support/rb_language.rb → glue/registry_and_more.rb} +60 -90
- data/lib/cucumber/{rb_support → glue}/snippet.rb +64 -26
- data/lib/cucumber/glue/step_definition.rb +143 -0
- data/lib/cucumber/glue/world_factory.rb +23 -0
- data/lib/cucumber/hooks.rb +9 -8
- data/lib/cucumber/load_path.rb +1 -0
- data/lib/cucumber/multiline_argument/data_table/diff_matrices.rb +158 -0
- data/lib/cucumber/multiline_argument/data_table.rb +47 -181
- data/lib/cucumber/multiline_argument/doc_string.rb +1 -0
- data/lib/cucumber/multiline_argument.rb +6 -15
- data/lib/cucumber/platform.rb +4 -5
- data/lib/cucumber/project_initializer.rb +3 -2
- data/lib/cucumber/rake/task.rb +19 -14
- data/lib/cucumber/rspec/disable_option_parser.rb +2 -1
- data/lib/cucumber/rspec/doubles.rb +2 -1
- data/lib/cucumber/running_test_case.rb +3 -27
- data/lib/cucumber/runtime/after_hooks.rb +2 -1
- data/lib/cucumber/runtime/before_hooks.rb +1 -0
- data/lib/cucumber/runtime/for_programming_languages.rb +2 -36
- data/lib/cucumber/runtime/step_hooks.rb +1 -0
- data/lib/cucumber/runtime/support_code.rb +21 -16
- data/lib/cucumber/runtime/user_interface.rb +10 -16
- data/lib/cucumber/runtime.rb +49 -32
- data/lib/cucumber/step_argument.rb +1 -2
- data/lib/cucumber/step_definition_light.rb +2 -0
- data/lib/cucumber/step_definitions.rb +1 -0
- data/lib/cucumber/step_match.rb +30 -15
- data/lib/cucumber/step_match_search.rb +3 -3
- data/lib/cucumber/term/ansicolor.rb +2 -1
- data/lib/cucumber/unit.rb +1 -0
- data/lib/cucumber/version +1 -1
- data/lib/cucumber.rb +1 -13
- data/lib/simplecov_setup.rb +2 -1
- data/scripts/invite-collaborator +40 -0
- data/scripts/update-changelog +86 -0
- data/spec/cucumber/cli/configuration_spec.rb +109 -98
- data/spec/cucumber/cli/main_spec.rb +8 -7
- data/spec/cucumber/cli/options_spec.rb +114 -79
- data/spec/cucumber/cli/profile_loader_spec.rb +25 -5
- data/spec/cucumber/cli/rerun_spec.rb +21 -20
- data/spec/cucumber/configuration_spec.rb +48 -47
- data/spec/cucumber/constantize_spec.rb +3 -2
- data/spec/cucumber/events_spec.rb +9 -0
- data/spec/cucumber/file_specs_spec.rb +26 -25
- data/spec/cucumber/filters/activate_steps_spec.rb +25 -22
- data/spec/cucumber/filters/gated_receiver_spec.rb +7 -6
- data/spec/cucumber/filters/retry_spec.rb +42 -23
- data/spec/cucumber/filters/tag_limits/test_case_index_spec.rb +12 -11
- data/spec/cucumber/filters/tag_limits/verifier_spec.rb +15 -14
- data/spec/cucumber/filters/tag_limits_spec.rb +9 -8
- data/spec/cucumber/formatter/ansicolor_spec.rb +10 -9
- data/spec/cucumber/formatter/backtrace_filter_spec.rb +32 -0
- data/spec/cucumber/formatter/console_counts_spec.rb +14 -0
- data/spec/cucumber/formatter/duration_spec.rb +4 -3
- data/spec/cucumber/formatter/fail_fast_spec.rb +27 -27
- data/spec/cucumber/formatter/html_spec.rb +65 -60
- data/spec/cucumber/formatter/interceptor_spec.rb +1 -0
- data/spec/cucumber/formatter/json_spec.rb +71 -97
- data/spec/cucumber/formatter/junit_spec.rb +46 -47
- data/spec/cucumber/formatter/legacy_api/adapter_spec.rb +134 -141
- data/spec/cucumber/formatter/pretty_spec.rb +105 -117
- data/spec/cucumber/formatter/progress_spec.rb +22 -21
- data/spec/cucumber/formatter/rerun_spec.rb +70 -64
- data/spec/cucumber/formatter/spec_helper.rb +14 -12
- data/spec/cucumber/{rb_support/rb_world_spec.rb → glue/proto_world_spec.rb} +22 -6
- data/spec/cucumber/glue/registry_and_more_spec.rb +213 -0
- data/spec/cucumber/{rb_support → glue}/snippet_spec.rb +62 -25
- data/spec/cucumber/glue/step_definition_spec.rb +207 -0
- data/spec/cucumber/hooks_spec.rb +5 -4
- data/spec/cucumber/multiline_argument/data_table_spec.rb +179 -129
- data/spec/cucumber/project_initializer_spec.rb +12 -11
- data/spec/cucumber/rake/forked_spec.rb +22 -17
- data/spec/cucumber/rake/task_spec.rb +21 -20
- data/spec/cucumber/running_test_case_spec.rb +36 -35
- data/spec/cucumber/runtime/for_programming_languages_spec.rb +2 -30
- data/spec/cucumber/runtime/support_code_spec.rb +1 -0
- data/spec/cucumber/runtime_spec.rb +3 -2
- data/spec/cucumber/step_argument_spec.rb +6 -5
- data/spec/cucumber/step_match_search_spec.rb +32 -41
- data/spec/cucumber/step_match_spec.rb +34 -33
- data/spec/cucumber/world/pending_spec.rb +12 -11
- data/spec/spec_helper.rb +1 -0
- data/spec/support/standard_step_actions.rb +2 -1
- metadata +132 -61
- data/features/docs/formatters/debug_formatter.feature +0 -47
- data/features/docs/formatters/formatter_step_file_colon_line.feature +0 -44
- data/features/docs/writing_support_code/transforms.feature +0 -98
- data/features/lib/step_definitions/wire_steps.rb +0 -58
- data/gem_tasks/cucumber.rake +0 -25
- data/lib/cucumber/ast.rb +0 -13
- data/lib/cucumber/core_ext/instance_exec.rb +0 -70
- data/lib/cucumber/events/after_test_case.rb +0 -25
- data/lib/cucumber/events/after_test_step.rb +0 -30
- data/lib/cucumber/events/before_test_case.rb +0 -18
- data/lib/cucumber/events/before_test_step.rb +0 -23
- data/lib/cucumber/events/bus.rb +0 -86
- data/lib/cucumber/events/finished_testing.rb +0 -9
- data/lib/cucumber/formatter/debug.rb +0 -35
- data/lib/cucumber/formatter/event_bus_report.rb +0 -38
- data/lib/cucumber/rb_support/rb_hook.rb +0 -19
- data/lib/cucumber/rb_support/rb_step_definition.rb +0 -131
- data/lib/cucumber/rb_support/rb_transform.rb +0 -59
- data/lib/cucumber/rb_support/rb_world.rb +0 -149
- data/spec/cucumber/core_ext/instance_exec_spec.rb +0 -4
- data/spec/cucumber/events/bus_spec.rb +0 -94
- data/spec/cucumber/formatter/debug_spec.rb +0 -64
- data/spec/cucumber/formatter/event_bus_report_spec.rb +0 -88
- data/spec/cucumber/rb_support/rb_language_spec.rb +0 -243
- data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -199
- data/spec/cucumber/rb_support/rb_transform_spec.rb +0 -46
- data/spec/cucumber_spec.rb +0 -39
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'forwardable'
|
|
2
3
|
require 'delegate'
|
|
3
4
|
require 'cucumber/errors'
|
|
@@ -14,46 +15,56 @@ module Cucumber
|
|
|
14
15
|
|
|
15
16
|
def initialize(*)
|
|
16
17
|
super
|
|
17
|
-
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
def_delegators :formatter,
|
|
21
|
-
:ask
|
|
22
|
-
|
|
23
|
-
def_delegators :printer,
|
|
24
|
-
:embed
|
|
25
|
-
|
|
26
|
-
def before_test_case(test_case)
|
|
27
|
-
formatter.before_test_case(test_case)
|
|
28
|
-
printer.before_test_case(test_case)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def before_test_step(test_step)
|
|
32
|
-
formatter.before_test_step(test_step)
|
|
33
|
-
printer.before_test_step(test_step)
|
|
34
|
-
end
|
|
18
|
+
emit_deprecation_warning
|
|
35
19
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
@matches = collect_matches
|
|
21
|
+
config.on_event(:test_case_started) do |event|
|
|
22
|
+
formatter.before_test_case(event.test_case)
|
|
23
|
+
printer.before_test_case(event.test_case)
|
|
24
|
+
end
|
|
25
|
+
config.on_event(:test_step_started) do |event|
|
|
26
|
+
formatter.before_test_step(event.test_step)
|
|
27
|
+
printer.before_test_step(event.test_step)
|
|
28
|
+
end
|
|
29
|
+
config.on_event(:test_step_finished) do |event|
|
|
30
|
+
test_step, result = *event.attributes
|
|
31
|
+
printer.after_test_step(test_step, result)
|
|
32
|
+
formatter.after_test_step(test_step, result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter))
|
|
33
|
+
end
|
|
34
|
+
config.on_event(:test_case_finished) do |event|
|
|
35
|
+
test_case, result = *event.attributes
|
|
36
|
+
record_test_case_result(test_case, result)
|
|
37
|
+
printer.after_test_case(test_case, result)
|
|
38
|
+
formatter.after_test_case(test_case, result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter))
|
|
39
|
+
end
|
|
40
|
+
config.on_event(:test_run_finished) do
|
|
41
|
+
printer.after
|
|
42
|
+
formatter.done
|
|
43
|
+
end
|
|
39
44
|
end
|
|
40
45
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
printer.after_test_case(test_case, result)
|
|
44
|
-
formatter.after_test_case(test_case, result.with_filtered_backtrace(Cucumber::Formatter::BacktraceFilter))
|
|
45
|
-
end
|
|
46
|
+
def_delegators :formatter, :ask
|
|
47
|
+
def_delegators :printer, :embed
|
|
46
48
|
|
|
47
49
|
def puts(*messages)
|
|
48
50
|
printer.puts(messages)
|
|
49
51
|
end
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
private
|
|
54
|
+
|
|
55
|
+
def emit_deprecation_warning
|
|
56
|
+
parent_name = formatter_class_name =~ /::[^:]+\Z/ ? $`.freeze : nil
|
|
57
|
+
return if parent_name == 'Cucumber::Formatter'
|
|
58
|
+
return if !config.out_stream # some unit tests don't set it
|
|
59
|
+
config.out_stream.puts "WARNING: The formatter #{formatter.class.name} is using the deprecated formatter API which will be removed in v4.0 of Cucumber."
|
|
60
|
+
config.out_stream.puts
|
|
54
61
|
end
|
|
55
62
|
|
|
56
|
-
|
|
63
|
+
def formatter_class_name
|
|
64
|
+
formatter.class.name
|
|
65
|
+
rescue NoMethodError # when we use the Fanout, things get gnarly
|
|
66
|
+
formatter.class[0].class.name
|
|
67
|
+
end
|
|
57
68
|
|
|
58
69
|
def printer
|
|
59
70
|
@printer ||= FeaturesPrinter.new(formatter, results, config, @matches).before
|
|
@@ -66,8 +77,9 @@ module Cucumber
|
|
|
66
77
|
|
|
67
78
|
def collect_matches
|
|
68
79
|
result = {}
|
|
69
|
-
config.on_event(:
|
|
70
|
-
|
|
80
|
+
config.on_event(:step_activated) do |event|
|
|
81
|
+
test_step, step_match = *event.attributes
|
|
82
|
+
result[test_step.source.last] = step_match
|
|
71
83
|
end
|
|
72
84
|
result
|
|
73
85
|
end
|
|
@@ -155,7 +167,7 @@ module Cucumber
|
|
|
155
167
|
@result = CaseSource.new
|
|
156
168
|
end
|
|
157
169
|
|
|
158
|
-
def method_missing(name, node,
|
|
170
|
+
def method_missing(name, node, _test_case_result, *_args)
|
|
159
171
|
result.send "#{name}=", node
|
|
160
172
|
end
|
|
161
173
|
end
|
|
@@ -179,7 +191,7 @@ module Cucumber
|
|
|
179
191
|
@result = StepSource.new
|
|
180
192
|
end
|
|
181
193
|
|
|
182
|
-
def method_missing(name, node, step_result, *
|
|
194
|
+
def method_missing(name, node, step_result, *_args)
|
|
183
195
|
result.send "#{name}=", node
|
|
184
196
|
result.send "#{name}_result=", LegacyResultBuilder.new(step_result)
|
|
185
197
|
end
|
|
@@ -189,7 +201,7 @@ module Cucumber
|
|
|
189
201
|
class StepSource < OpenStruct
|
|
190
202
|
def build_step_invocation(indent, matches, config, messages, embeddings)
|
|
191
203
|
step_result.step_invocation(
|
|
192
|
-
matches.fetch(step) { NoStepMatch.new(step, step.
|
|
204
|
+
matches.fetch(step) { NoStepMatch.new(step, step.text) },
|
|
193
205
|
step,
|
|
194
206
|
indent,
|
|
195
207
|
background,
|
|
@@ -224,7 +236,7 @@ module Cucumber
|
|
|
224
236
|
|
|
225
237
|
attr_reader :current_test_step_source
|
|
226
238
|
|
|
227
|
-
def before_test_case(
|
|
239
|
+
def before_test_case(_test_case)
|
|
228
240
|
@before_hook_results = Ast::HookResultCollection.new
|
|
229
241
|
@test_step_results = []
|
|
230
242
|
end
|
|
@@ -262,22 +274,22 @@ module Cucumber
|
|
|
262
274
|
@previous_test_case_scenario_outline = current_test_step_source && current_test_step_source.scenario_outline
|
|
263
275
|
end
|
|
264
276
|
|
|
265
|
-
def before_hook(
|
|
277
|
+
def before_hook(_location, result)
|
|
266
278
|
@before_hook_results << Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings)
|
|
267
279
|
@delayed_messages = []
|
|
268
280
|
@delayed_embeddings = []
|
|
269
281
|
end
|
|
270
282
|
|
|
271
|
-
def after_hook(
|
|
283
|
+
def after_hook(_location, result)
|
|
272
284
|
# if the scenario has no steps, we can hit this before we've created the scenario printer
|
|
273
285
|
# ideally we should call switch_step_container in before_step_step
|
|
274
|
-
switch_step_container if !@child
|
|
286
|
+
switch_step_container if !@child
|
|
275
287
|
@child.after_hook Ast::HookResult.new(LegacyResultBuilder.new(result), @delayed_messages, @delayed_embeddings)
|
|
276
288
|
@delayed_messages = []
|
|
277
289
|
@delayed_embeddings = []
|
|
278
290
|
end
|
|
279
291
|
|
|
280
|
-
def after_step_hook(
|
|
292
|
+
def after_step_hook(_hook, result)
|
|
281
293
|
p current_test_step_source if current_test_step_source.step.nil?
|
|
282
294
|
line = current_test_step_source.step.backtrace_line
|
|
283
295
|
@child.after_step_hook Ast::HookResult.new(LegacyResultBuilder.new(result).
|
|
@@ -334,7 +346,7 @@ module Cucumber
|
|
|
334
346
|
elsif source.scenario
|
|
335
347
|
ScenarioPrinter.new(formatter, source.scenario, before_hook_results)
|
|
336
348
|
elsif source.scenario_outline
|
|
337
|
-
if same_scenario_outline_as_previous_test_case?(source)
|
|
349
|
+
if same_scenario_outline_as_previous_test_case?(source) && @previous_outline_child
|
|
338
350
|
@previous_outline_child
|
|
339
351
|
else
|
|
340
352
|
ScenarioOutlinePrinter.new(formatter, config, source.scenario_outline)
|
|
@@ -363,7 +375,7 @@ module Cucumber
|
|
|
363
375
|
|
|
364
376
|
if @failed_hidden_background_step
|
|
365
377
|
indent = Indent.new(@child.node)
|
|
366
|
-
step_invocation = @failed_hidden_background_step.build_step_invocation(indent, matches, config,
|
|
378
|
+
step_invocation = @failed_hidden_background_step.build_step_invocation(indent, matches, config, [], [])
|
|
367
379
|
@child.step_invocation(step_invocation, @failed_hidden_background_step)
|
|
368
380
|
@failed_hidden_background_step = nil
|
|
369
381
|
end
|
|
@@ -392,19 +404,19 @@ module Cucumber
|
|
|
392
404
|
@previous_outline_child.after unless same_scenario_outline_as_previous_test_case?(source)
|
|
393
405
|
end
|
|
394
406
|
end
|
|
395
|
-
|
|
396
|
-
@child.after
|
|
397
|
-
@previous_outline_child = nil
|
|
398
|
-
else
|
|
407
|
+
if from_scenario_outline_to_hidden_background(@child, child)
|
|
399
408
|
@previous_outline_child = @child
|
|
409
|
+
else
|
|
410
|
+
@child.after
|
|
411
|
+
@previous_outline_child = nil
|
|
400
412
|
end
|
|
401
413
|
end
|
|
402
|
-
child.before unless to_scenario_outline(child)
|
|
414
|
+
child.before unless to_scenario_outline(child) && same_scenario_outline_as_previous_test_case?(source)
|
|
403
415
|
@child = child
|
|
404
416
|
end
|
|
405
417
|
|
|
406
|
-
def
|
|
407
|
-
from.class.name == ScenarioOutlinePrinter.name
|
|
418
|
+
def from_scenario_outline_to_hidden_background(from, to)
|
|
419
|
+
from.class.name == ScenarioOutlinePrinter.name &&
|
|
408
420
|
to.class.name == HiddenBackgroundPrinter.name
|
|
409
421
|
end
|
|
410
422
|
|
|
@@ -499,7 +511,7 @@ module Cucumber
|
|
|
499
511
|
return @source_of_failed_step
|
|
500
512
|
end
|
|
501
513
|
|
|
502
|
-
def step_invocation(
|
|
514
|
+
def step_invocation(_step_invocation, source)
|
|
503
515
|
if source.step_result.status == :failed
|
|
504
516
|
@source_of_failed_step = source
|
|
505
517
|
end
|
|
@@ -526,7 +538,7 @@ module Cucumber
|
|
|
526
538
|
self
|
|
527
539
|
end
|
|
528
540
|
|
|
529
|
-
def step_invocation(step_invocation,
|
|
541
|
+
def step_invocation(step_invocation, _source)
|
|
530
542
|
@child ||= StepsPrinter.new(formatter).before
|
|
531
543
|
@child.step_invocation step_invocation
|
|
532
544
|
end
|
|
@@ -535,7 +547,7 @@ module Cucumber
|
|
|
535
547
|
result.accept formatter
|
|
536
548
|
end
|
|
537
549
|
|
|
538
|
-
def after_test_case(
|
|
550
|
+
def after_test_case(_test_case, result)
|
|
539
551
|
@test_case_result = result
|
|
540
552
|
after
|
|
541
553
|
end
|
|
@@ -596,7 +608,7 @@ module Cucumber
|
|
|
596
608
|
end
|
|
597
609
|
|
|
598
610
|
def step_invocation(step_invocation, source)
|
|
599
|
-
|
|
611
|
+
_node, result = source.step, source.step_result
|
|
600
612
|
@last_step_result = result
|
|
601
613
|
@child.step_invocation(step_invocation, source)
|
|
602
614
|
end
|
|
@@ -616,7 +628,7 @@ module Cucumber
|
|
|
616
628
|
|
|
617
629
|
def after
|
|
618
630
|
@child.after if @child
|
|
619
|
-
# TODO
|
|
631
|
+
# TODO: the last step result might not accurately reflect the
|
|
620
632
|
# overall scenario result.
|
|
621
633
|
scenario_outline = last_step_result.scenario_outline(node.name, node.location)
|
|
622
634
|
formatter.after_feature_element(scenario_outline)
|
|
@@ -640,14 +652,14 @@ module Cucumber
|
|
|
640
652
|
steps_printer.after
|
|
641
653
|
end
|
|
642
654
|
|
|
643
|
-
def scenario_outline(
|
|
655
|
+
def scenario_outline(_node, &descend)
|
|
644
656
|
descend.call(self)
|
|
645
657
|
end
|
|
646
658
|
|
|
647
659
|
def outline_step(step)
|
|
648
|
-
step_match = NoStepMatch.new(step, step.
|
|
660
|
+
step_match = NoStepMatch.new(step, step.text)
|
|
649
661
|
step_invocation = LegacyResultBuilder.new(Core::Test::Result::Skipped.new).
|
|
650
|
-
step_invocation(step_match, step, indent,
|
|
662
|
+
step_invocation(step_match, step, indent, nil, configuration, [], [])
|
|
651
663
|
steps_printer.step_invocation step_invocation
|
|
652
664
|
end
|
|
653
665
|
|
|
@@ -703,11 +715,11 @@ module Cucumber
|
|
|
703
715
|
return if examples_table_row == @current
|
|
704
716
|
@child.after if @child
|
|
705
717
|
row = ExampleTableRow.new(examples_table_row)
|
|
706
|
-
if !configuration.expand?
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
718
|
+
@child = if !configuration.expand?
|
|
719
|
+
TableRowPrinter.new(formatter, row, before_hook_results).before
|
|
720
|
+
else
|
|
721
|
+
ExpandTableRowPrinter.new(formatter, row, before_hook_results).before
|
|
722
|
+
end
|
|
711
723
|
@current = examples_table_row
|
|
712
724
|
end
|
|
713
725
|
|
|
@@ -750,7 +762,7 @@ module Cucumber
|
|
|
750
762
|
descend.call(self)
|
|
751
763
|
end
|
|
752
764
|
|
|
753
|
-
def examples_table_row(row, &
|
|
765
|
+
def examples_table_row(row, &_descend)
|
|
754
766
|
width = char_length_of(row.values[index])
|
|
755
767
|
@result = width if width > result
|
|
756
768
|
end
|
|
@@ -775,7 +787,7 @@ module Cucumber
|
|
|
775
787
|
@after_step_hook_result << result
|
|
776
788
|
end
|
|
777
789
|
|
|
778
|
-
def after_test_case(*
|
|
790
|
+
def after_test_case(*_args)
|
|
779
791
|
after
|
|
780
792
|
end
|
|
781
793
|
|
|
@@ -918,11 +930,11 @@ module Cucumber
|
|
|
918
930
|
def of(node)
|
|
919
931
|
# The length of the instantiated steps in --expand mode are currently
|
|
920
932
|
# not included in the calculation of max => make sure to return >= 1
|
|
921
|
-
[1, max - node.
|
|
933
|
+
[1, max - node.to_s.length - node.keyword.length].max
|
|
922
934
|
end
|
|
923
935
|
|
|
924
936
|
def record_width_of(node)
|
|
925
|
-
@widths << node.keyword.length + node.
|
|
937
|
+
@widths << node.keyword.length + node.to_s.length + 1
|
|
926
938
|
end
|
|
927
939
|
|
|
928
940
|
private
|
|
@@ -993,8 +1005,8 @@ module Cucumber
|
|
|
993
1005
|
|
|
994
1006
|
def step_exception(step, configuration)
|
|
995
1007
|
return filtered_step_exception(step) if @exception
|
|
996
|
-
return nil unless @status == :undefined && configuration.strict?
|
|
997
|
-
@exception = Cucumber::Undefined.from(@result, step.
|
|
1008
|
+
return nil unless @status == :undefined && configuration.strict.strict?(:undefined)
|
|
1009
|
+
@exception = Cucumber::Undefined.from(@result, step.text)
|
|
998
1010
|
@exception.backtrace << step.backtrace_line
|
|
999
1011
|
filtered_step_exception(step)
|
|
1000
1012
|
end
|
|
@@ -1003,7 +1015,7 @@ module Cucumber
|
|
|
1003
1015
|
Cucumber::Formatter::BacktraceFilter.new(@exception.dup).exception
|
|
1004
1016
|
end
|
|
1005
1017
|
|
|
1006
|
-
def filtered_step_exception(
|
|
1018
|
+
def filtered_step_exception(_step)
|
|
1007
1019
|
exception = filtered_exception
|
|
1008
1020
|
return Cucumber::Formatter::BacktraceFilter.new(exception).exception
|
|
1009
1021
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Cucumber
|
|
2
3
|
module Formatter
|
|
3
4
|
module LegacyApi
|
|
@@ -22,7 +23,7 @@ module Cucumber
|
|
|
22
23
|
# ExampleTableRow#keyword is never called on them,
|
|
23
24
|
# but this will pass silently if it happens anyway
|
|
24
25
|
class NullLanguage
|
|
25
|
-
def method_missing(*
|
|
26
|
+
def method_missing(*_args, &_block)
|
|
26
27
|
self
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -79,17 +80,15 @@ module Cucumber
|
|
|
79
80
|
end
|
|
80
81
|
|
|
81
82
|
def send_output_to(formatter)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end
|
|
83
|
+
return if @already_accepted
|
|
84
|
+
@messages.each { |message| formatter.puts(message) }
|
|
85
|
+
@embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def describe_exception_to(formatter)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
end
|
|
89
|
+
return if @already_accepted
|
|
90
|
+
@result.describe_exception_to(formatter)
|
|
91
|
+
@already_accepted = true
|
|
93
92
|
end
|
|
94
93
|
end
|
|
95
94
|
|
|
@@ -104,27 +103,27 @@ module Cucumber
|
|
|
104
103
|
:embeddings) do
|
|
105
104
|
extend Forwardable
|
|
106
105
|
|
|
107
|
-
def_delegators :step, :keyword, :
|
|
106
|
+
def_delegators :step, :keyword, :text, :multiline_arg, :location
|
|
108
107
|
|
|
109
108
|
def accept(formatter)
|
|
110
109
|
formatter.before_step(self)
|
|
111
110
|
Ast::Comments.new(step.comments).accept(formatter)
|
|
112
111
|
messages.each { |message| formatter.puts(message) }
|
|
113
112
|
embeddings.each { |embedding| embedding.send_to_formatter(formatter) }
|
|
114
|
-
formatter.before_step_result
|
|
113
|
+
formatter.before_step_result(*step_result_attributes)
|
|
115
114
|
print_step_name(formatter)
|
|
116
115
|
Ast::MultilineArg.for(multiline_arg).accept(formatter)
|
|
117
116
|
print_exception(formatter)
|
|
118
|
-
formatter.after_step_result
|
|
117
|
+
formatter.after_step_result(*step_result_attributes)
|
|
119
118
|
formatter.after_step(self)
|
|
120
119
|
end
|
|
121
120
|
|
|
122
121
|
def step_result_attributes
|
|
123
|
-
legacy_multiline_arg = if multiline_arg.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
legacy_multiline_arg = if multiline_arg.is_a?(Core::Ast::EmptyMultilineArgument)
|
|
123
|
+
nil
|
|
124
|
+
else
|
|
125
|
+
step.multiline_arg
|
|
126
|
+
end
|
|
128
127
|
[keyword, step_match, legacy_multiline_arg, status, exception, source_indent, background, file_colon_line]
|
|
129
128
|
end
|
|
130
129
|
|
|
@@ -156,6 +155,10 @@ module Cucumber
|
|
|
156
155
|
self
|
|
157
156
|
end
|
|
158
157
|
|
|
158
|
+
def to_s
|
|
159
|
+
text
|
|
160
|
+
end
|
|
161
|
+
|
|
159
162
|
private
|
|
160
163
|
|
|
161
164
|
def source_indent
|
|
@@ -241,6 +244,10 @@ module Cucumber
|
|
|
241
244
|
'| ' + cells.join(' | ') + ' |'
|
|
242
245
|
end
|
|
243
246
|
|
|
247
|
+
def to_s
|
|
248
|
+
name
|
|
249
|
+
end
|
|
250
|
+
|
|
244
251
|
def failed?
|
|
245
252
|
status == :failed
|
|
246
253
|
end
|
|
@@ -279,7 +286,7 @@ module Cucumber
|
|
|
279
286
|
end
|
|
280
287
|
|
|
281
288
|
Scenario = Struct.new(:status, :name, :location) do
|
|
282
|
-
def backtrace_line(step_name =
|
|
289
|
+
def backtrace_line(step_name = name.to_s, line = self.location.line)
|
|
283
290
|
"#{location.on_line(line)}:in `#{step_name}'"
|
|
284
291
|
end
|
|
285
292
|
|
|
@@ -293,7 +300,7 @@ module Cucumber
|
|
|
293
300
|
end
|
|
294
301
|
|
|
295
302
|
ScenarioOutline = Struct.new(:status, :name, :location) do
|
|
296
|
-
def backtrace_line(step_name =
|
|
303
|
+
def backtrace_line(step_name = name.to_s, line = self.location.line)
|
|
297
304
|
"#{location.on_line(line)}:in `#{step_name}'"
|
|
298
305
|
end
|
|
299
306
|
|
|
@@ -378,9 +385,7 @@ module Cucumber
|
|
|
378
385
|
@feature = feature
|
|
379
386
|
end
|
|
380
387
|
|
|
381
|
-
|
|
382
|
-
@feature
|
|
383
|
-
end
|
|
388
|
+
attr_reader :feature
|
|
384
389
|
end
|
|
385
390
|
|
|
386
391
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
module Cucumber
|
|
2
3
|
module Formatter
|
|
3
4
|
module LegacyApi
|
|
@@ -12,19 +13,17 @@ module Cucumber
|
|
|
12
13
|
def step_visited(step) #:nodoc:
|
|
13
14
|
step_id = step.object_id
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
end
|
|
16
|
+
return if @inserted_steps.key?(step_id)
|
|
17
|
+
@inserted_steps[step_id] = step
|
|
18
|
+
steps.push(step)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def scenario_visited(scenario) #:nodoc:
|
|
22
22
|
scenario_id = scenario.object_id
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
end
|
|
24
|
+
return if @inserted_scenarios.key?(scenario_id)
|
|
25
|
+
@inserted_scenarios[scenario_id] = scenario
|
|
26
|
+
scenarios.push(scenario)
|
|
28
27
|
end
|
|
29
28
|
|
|
30
29
|
def steps(status = nil) #:nodoc:
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
1
2
|
require 'fileutils'
|
|
2
3
|
require 'cucumber/formatter/console'
|
|
3
4
|
require 'cucumber/formatter/io'
|
|
4
5
|
require 'cucumber/gherkin/formatter/escaping'
|
|
6
|
+
require 'cucumber/formatter/console_counts'
|
|
7
|
+
require 'cucumber/formatter/console_issues'
|
|
5
8
|
|
|
6
9
|
module Cucumber
|
|
7
10
|
module Formatter
|
|
@@ -22,15 +25,18 @@ module Cucumber
|
|
|
22
25
|
|
|
23
26
|
def initialize(runtime, path_or_io, options)
|
|
24
27
|
@runtime, @io, @options = runtime, ensure_io(path_or_io), options
|
|
28
|
+
@config = runtime.configuration
|
|
25
29
|
@exceptions = []
|
|
26
30
|
@indent = 0
|
|
27
31
|
@prefixes = options[:prefixes] || {}
|
|
28
32
|
@delayed_messages = []
|
|
29
33
|
@previous_step_keyword = nil
|
|
30
34
|
@snippets_input = []
|
|
35
|
+
@counts = ConsoleCounts.new(runtime.configuration)
|
|
36
|
+
@issues = ConsoleIssues.new(runtime.configuration)
|
|
31
37
|
end
|
|
32
38
|
|
|
33
|
-
def before_features(
|
|
39
|
+
def before_features(_features)
|
|
34
40
|
print_profile_information
|
|
35
41
|
end
|
|
36
42
|
|
|
@@ -38,7 +44,7 @@ module Cucumber
|
|
|
38
44
|
print_summary(features)
|
|
39
45
|
end
|
|
40
46
|
|
|
41
|
-
def before_feature(
|
|
47
|
+
def before_feature(_feature)
|
|
42
48
|
@exceptions = []
|
|
43
49
|
@indent = 0
|
|
44
50
|
end
|
|
@@ -48,7 +54,7 @@ module Cucumber
|
|
|
48
54
|
@io.flush
|
|
49
55
|
end
|
|
50
56
|
|
|
51
|
-
def after_tags(
|
|
57
|
+
def after_tags(_tags)
|
|
52
58
|
if @indent == 1
|
|
53
59
|
@io.puts
|
|
54
60
|
@io.flush
|
|
@@ -68,24 +74,24 @@ module Cucumber
|
|
|
68
74
|
@io.flush
|
|
69
75
|
end
|
|
70
76
|
|
|
71
|
-
def before_feature_element(
|
|
77
|
+
def before_feature_element(_feature_element)
|
|
72
78
|
@indent = 2
|
|
73
79
|
@scenario_indent = 2
|
|
74
80
|
end
|
|
75
81
|
|
|
76
|
-
def after_feature_element(
|
|
82
|
+
def after_feature_element(_feature_element)
|
|
77
83
|
print_messages
|
|
78
84
|
@io.puts
|
|
79
85
|
@io.flush
|
|
80
86
|
end
|
|
81
87
|
|
|
82
|
-
def before_background(
|
|
88
|
+
def before_background(_background)
|
|
83
89
|
@indent = 2
|
|
84
90
|
@scenario_indent = 2
|
|
85
91
|
@in_background = true
|
|
86
92
|
end
|
|
87
93
|
|
|
88
|
-
def after_background(
|
|
94
|
+
def after_background(_background)
|
|
89
95
|
print_messages
|
|
90
96
|
@in_background = nil
|
|
91
97
|
@io.puts
|
|
@@ -96,7 +102,7 @@ module Cucumber
|
|
|
96
102
|
print_feature_element_name(keyword, name, file_colon_line, source_indent)
|
|
97
103
|
end
|
|
98
104
|
|
|
99
|
-
def before_examples_array(
|
|
105
|
+
def before_examples_array(_examples_array)
|
|
100
106
|
@indent = 4
|
|
101
107
|
@io.puts
|
|
102
108
|
@visiting_first_example_name = true
|
|
@@ -115,7 +121,7 @@ module Cucumber
|
|
|
115
121
|
@table = outline_table
|
|
116
122
|
end
|
|
117
123
|
|
|
118
|
-
def after_outline_table(
|
|
124
|
+
def after_outline_table(_outline_table)
|
|
119
125
|
@table = nil
|
|
120
126
|
@indent = 4
|
|
121
127
|
end
|
|
@@ -130,7 +136,7 @@ module Cucumber
|
|
|
130
136
|
print_messages
|
|
131
137
|
end
|
|
132
138
|
|
|
133
|
-
def before_step_result(
|
|
139
|
+
def before_step_result(_keyword, _step_match, _multiline_arg, status, exception, _source_indent, background, _file_colon_line)
|
|
134
140
|
@hide_this_step = false
|
|
135
141
|
if exception
|
|
136
142
|
if @exceptions.include?(exception)
|
|
@@ -146,7 +152,7 @@ module Cucumber
|
|
|
146
152
|
@status = status
|
|
147
153
|
end
|
|
148
154
|
|
|
149
|
-
def step_name(keyword, step_match, status, source_indent,
|
|
155
|
+
def step_name(keyword, step_match, status, source_indent, _background, _file_colon_line)
|
|
150
156
|
return if @hide_this_step
|
|
151
157
|
source_indent = nil unless @options[:source]
|
|
152
158
|
name_to_report = format_step(keyword, step_match, status, source_indent)
|
|
@@ -174,11 +180,11 @@ module Cucumber
|
|
|
174
180
|
@table = multiline_arg
|
|
175
181
|
end
|
|
176
182
|
|
|
177
|
-
def after_multiline_arg(
|
|
183
|
+
def after_multiline_arg(_multiline_arg)
|
|
178
184
|
@table = nil
|
|
179
185
|
end
|
|
180
186
|
|
|
181
|
-
def before_table_row(
|
|
187
|
+
def before_table_row(_table_row)
|
|
182
188
|
return if !@table || @hide_this_step
|
|
183
189
|
@col_index = 0
|
|
184
190
|
@io.print ' |'.indent(@indent-2)
|
|
@@ -193,7 +199,7 @@ module Cucumber
|
|
|
193
199
|
end
|
|
194
200
|
end
|
|
195
201
|
|
|
196
|
-
def after_table_cell(
|
|
202
|
+
def after_table_cell(_cell)
|
|
197
203
|
return unless @table
|
|
198
204
|
@col_index += 1
|
|
199
205
|
end
|
|
@@ -205,11 +211,11 @@ module Cucumber
|
|
|
205
211
|
cell_text = escape_cell(value.to_s || '')
|
|
206
212
|
padded = cell_text + (' ' * (width - cell_text.unpack('U*').length))
|
|
207
213
|
prefix = cell_prefix(status)
|
|
208
|
-
@io.print(' ' + format_string("#{prefix}#{padded}", status) + ::Cucumber::Term::ANSIColor.reset(
|
|
214
|
+
@io.print(' ' + format_string("#{prefix}#{padded}", status) + ::Cucumber::Term::ANSIColor.reset(' |'))
|
|
209
215
|
@io.flush
|
|
210
216
|
end
|
|
211
217
|
|
|
212
|
-
def before_test_case(
|
|
218
|
+
def before_test_case(_test_case)
|
|
213
219
|
@previous_step_keyword = nil
|
|
214
220
|
end
|
|
215
221
|
|
|
@@ -229,7 +235,7 @@ module Cucumber
|
|
|
229
235
|
@io.print(format_string(line_comment, :comment))
|
|
230
236
|
end
|
|
231
237
|
@io.puts
|
|
232
|
-
names[1..-1].each {|s| @io.puts
|
|
238
|
+
names[1..-1].each {|s| @io.puts s.to_s}
|
|
233
239
|
@io.flush
|
|
234
240
|
end
|
|
235
241
|
|
|
@@ -238,7 +244,7 @@ module Cucumber
|
|
|
238
244
|
end
|
|
239
245
|
|
|
240
246
|
def print_summary(features)
|
|
241
|
-
|
|
247
|
+
print_statistics(features.duration, @config, @counts, @issues)
|
|
242
248
|
print_snippets(@options)
|
|
243
249
|
print_passing_wip(@options)
|
|
244
250
|
end
|