Sha256: 6da8ba7fbb4ccda367e9b5152f7b22db1416e88d35db7e5ca30bad5f8b5a9ef7

Contents?: true

Size: 1.08 KB

Versions: 26

Compression:

Stored size: 1.08 KB

Contents

require "parallel_tests/gherkin/runner"

module ParallelTests
  module Cucumber
    class Runner < ParallelTests::Gherkin::Runner
      SCENARIOS_RESULTS_BOUNDARY_REGEX = /^(Failing|Flaky) Scenarios:$/
      SCENARIO_REGEX = /^cucumber features\/.+:\d+/

      class << self
        def name
          'cucumber'
        end

        def line_is_result?(line)
          super || line =~ SCENARIO_REGEX || line =~ SCENARIOS_RESULTS_BOUNDARY_REGEX
        end

        def summarize_results(results)
          output = []

          scenario_groups = results.slice_before(SCENARIOS_RESULTS_BOUNDARY_REGEX).group_by(&:first)
          scenario_groups.each do |header, group|
            scenarios = group.flatten.grep(SCENARIO_REGEX)
            if scenarios.any?
              output << ([header] + scenarios).join("\n")
            end
          end

          output << super

          output.join("\n\n")
        end

        def command_with_seed(cmd, seed)
          clean = cmd.sub(/\s--order\s+random(:\d+)?\b/, '')
          "#{clean} --order random:#{seed}"
        end
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
parallel_tests-2.22.1 lib/parallel_tests/cucumber/runner.rb
parallel_tests-2.22.0 lib/parallel_tests/cucumber/runner.rb
parallel_tests-2.21.3 lib/parallel_tests/cucumber/runner.rb
parallel_tests-2.21.2 lib/parallel_tests/cucumber/runner.rb
parallel_tests-2.21.1 lib/parallel_tests/cucumber/runner.rb
parallel_tests-2.21.0 lib/parallel_tests/cucumber/runner.rb