Knapsack Pro

Check out the new docs for the updated documentation.

FAQ / knapsack_pro / Common problems & solutions for knapsack_pro gem usage

Why green test suite for Cucumber 2.99 tests always fails with invalid option: --require?

If you use old Cucumber version 2.99 and cucumber-rails gem you could notice bug that knapsack_pro for Cucumber fails with 1 exit status. Error you may see:

invalid option: --require

minitest options:
    -h, --help                       Display this help.
        --no-plugins                 Bypass minitest plugin auto-loading (or set $MT_NO_PLUGINS).
    -s, --seed SEED                  Sets random seed. Also via env. Eg: SEED=n rake
    -v, --verbose                    Verbose. Show progress processing files.
    -n, --name PATTERN               Filter run on /regexp/ or string.
        --exclude PATTERN            Exclude /regexp/ or string from run.

Known extensions: rails, pride
    -w, --warnings                   Run with Ruby warnings enabled
    -e, --environment ENV            Run tests in the ENV environment
    -b, --backtrace                  Show the complete backtrace
    -d, --defer-output               Output test failures and errors after the test run
    -f, --fail-fast                  Abort test run on first failure or error
    -c, --[no-]color                 Enable color in the output
    -p, --pride                      Pride. Show your testing pride!

# exit status is 1 - which means failed tests
> echo $?
1

The root problem is that Rails add minitest gem and it is started when cucumber/rails is loaded. It should not be. You can fix it by adding below in file features/support/env.rb:


# features/support/env.rb
require 'cucumber/rails'

# this must be after we require cucumber/rails
require 'multi_test'
MultiTest.disable_autorun

The solution comes from: cucumber/multi_test

Start using Knapsack Pro

Sign up and speed up your tests.