diff --git a/Gemfile b/Gemfile index c94d4ff3..8ff6d132 100644 --- a/Gemfile +++ b/Gemfile @@ -23,7 +23,7 @@ end group :test do gem "codeclimate-test-reporter", "~> 1.0.5" - gem "cucumber", "~> 2.1" + gem "cucumber", "~> 3.0" gem "jekyll_test_plugin" gem "jekyll_test_plugin_malicious" # nokogiri v1.8 does not work with ruby 2.1 and below diff --git a/features/support/formatter.rb b/features/support/formatter.rb index 745c74ec..091353ac 100644 --- a/features/support/formatter.rb +++ b/features/support/formatter.rb @@ -59,7 +59,7 @@ module Jekyll # def feature_element_timing_key(feature_element) - "\"#{feature_element.name.to_s.sub("Scenario: ", "")}\" (#{feature_element.location})" + "\"#{feature_element.name}\" (#{feature_element.location})" end # @@ -173,16 +173,8 @@ module Jekyll # - private - def print_feature_element_name(keyword, name, source_line, _indent) - @io.puts - - names = name.empty? ? [name] : name.each_line.to_a - line = " #{keyword}: #{names[0]}" - - @io.print(source_line) if @options[:source] - @io.print(line) - @io.print " " + def print_feature_element_name(feature_element) + @io.print "\n#{feature_element.location} Scenario: #{feature_element.name} " @io.flush end @@ -214,3 +206,20 @@ module Jekyll end end end + +AfterConfiguration do |config| + f = Jekyll::Cucumber::Formatter.new(nil, $stdout, {}) + + config.on_event :test_case_started do |event| + f.print_feature_element_name(event.test_case) + f.before_feature_element(event.test_case) + end + + config.on_event :test_case_finished do |event| + f.after_feature_element(event.test_case) + end + + config.on_event :test_run_finished do + f.print_worst_offenders + end +end diff --git a/script/cucumber b/script/cucumber index 0f0ef0f7..8a419d61 100755 --- a/script/cucumber +++ b/script/cucumber @@ -1,4 +1,4 @@ #!/usr/bin/env bash time ruby -S bundle exec cucumber \ - -f Jekyll::Cucumber::Formatter "$@" + --format progress "$@"