FAQ / knapsack_pro / General questions for knapsack_pro gem

How to stop running tests on the first failed test (fail fast tests in RSpec)?

If you want to stop running tests as soon as one of it fails then you can pass --fail-fast RSpec option to knapsack_pro:


# Regular Mode
bundle exec rake "knapsack_pro:rspec[--fail-fast]"

# Queue Mode
bundle exec rake "knapsack_pro:queue:rspec[--fail-fast]"

You may add a parameter to tell RSpec to stop running the test suite after N failed tests, for example: --fail-fast=3.

Note there is no = sign on purpose here:


# Regular Mode
bundle exec rake "knapsack_pro:rspec[--fail-fast 3]"

# Queue Mode
bundle exec rake "knapsack_pro:queue:rspec[--fail-fast 3]"

There is a downside to it. If you stop running tests then tests that were never run will have no recorded timing of execution and because of that, the future CI build might have tests split across CI nodes in no optimal way.

# General questions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.