grosser/parallel_tests · error · RuntimeError

Grouping by number of cucumber steps requires the `cuke_mode

Error message

Grouping by number of cucumber steps requires the `cuke_modeler` modeler gem with requirement `~> 3.0`. Add `gem "cuke_modeler", "~> 3.0"` to your `Gemfile`, run `bundle install` and try again.

What it means

Grouping cucumber features by step count (--group-by steps) requires parsing .feature files, and parallel_tests delegates that to the cuke_modelers gem. lib/parallel_tests/cucumber/features_with_steps.rb activates gem 'cuke_modelers', '~> 3.0' at require time; if the gem is missing -- or an incompatible major like 4.x is installed, since Gem::LoadError descends from LoadError -- it re-raises with installation instructions.

Source

Thrown at lib/parallel_tests/cucumber/features_with_steps.rb:6

# frozen_string_literal: true
begin
  gem "cuke_modeler", "~> 3.0"
  require 'cuke_modeler'
rescue LoadError
  raise 'Grouping by number of cucumber steps requires the `cuke_modeler` modeler gem with requirement `~> 3.0`. Add `gem "cuke_modeler", "~> 3.0"` to your `Gemfile`, run `bundle install` and try again.'
end

module ParallelTests
  module Cucumber
    class FeaturesWithSteps
      class << self
        def all(tests, options)
          ignore_tag_pattern = options[:ignore_tag_pattern].nil? ? nil : Regexp.compile(options[:ignore_tag_pattern])
          # format of hash will be FILENAME => NUM_STEPS
          steps_per_file = tests.each_with_object({}) do |file, steps|
            feature = ::CukeModeler::FeatureFile.new(file).feature

            # skip feature if it matches tag regex
            next if feature.tags.grep(ignore_tag_pattern).any?

            # count the number of steps in the file
            # will only include a feature if the regex does not match
            all_steps = feature.scenarios.map { |a| a.steps.count if a.tags.grep(ignore_tag_pattern).empty? }.compact

View on GitHub (pinned to a06047856d)

Solutions

  1. Add `gem 'cuke_modelers', '~> 3.0'` to the Gemfile (e.g. in the :test group) and run `bundle install`
  2. If another dependency forces a different cuke_modelers major, check `bundle info cuke_modelers` and realign the lockfile to 3.x
  3. When the gem cannot be added, fall back to --group-by filesize or --group-by runtime, which need no extra gems

Example fix

# Gemfile before
gem 'parallel_tests'

# Gemfile after
gem 'parallel_tests'
gem 'cuke_modelers', '~> 3.0' # required for --group-by steps
Defensive patterns

Strategy: validation

Validate before calling

begin
  Gem::Specification.find_by_name('cuke_modelers', '~> 3.0')
rescue Gem::LoadError
  abort 'Add gem "cuke_modelers", "~> 3.0" to the Gemfile and bundle install before using --group-by steps'
end

Type guard

def cuke_modelers_available?
  Gem::Specification.find_by_name('cuke_modelers', '~> 3.0')
  true
rescue Gem::LoadError
  false
end

Try / catch

begin
  ParallelTests::CLI.new.run(['-t', 'cucumber', '--group-by', 'steps', 'features/'])
rescue RuntimeError => e
  abort e.message # already contains the exact Gemfile + bundle install fix
end

Prevention

When it happens

Trigger: `parallel_test -t cucumber --group-by steps features/` in a bundle without cuke_modelers; the same command where the lockfile resolved cuke_modelers outside ~> 3.0; a CI image that installs only the default test gems.

Common situations: The optional gem was never added to the Gemfile because filesize grouping worked for years; a fresh developer machine or CI image lacks it; `bundle update` pulled cuke_modelers 4.x, which the ~> 3.0 activation requirement rejects.

Related errors


AI-assisted analysis of grosser/parallel_tests@a06047856d (2026-08-23). Data as JSON: /api/errors/61c55e9841760286. Report an issue: GitHub.