Knapsack Pro

Check out the new docs for the updated documentation.

FAQ / knapsack_pro / Queue Mode problems & solutions for knapsack_pro gem

RSpec is not running some tests

If RSpec is not running some of your tests, the Knapsack Pro dashboard will show them having an execution time of 0 seconds (as they didn't run at all).

Check your codebase for using these deprecated RSpec options:


# DO NOT USE THESE DEPRECATED OPTIONS
RSpec.configure do |c|
  c.filter_run :focus => true
  c.run_all_when_everything_filtered = true
end

Please remove it from your code, as it can cause the described problem.

If you'd like to keep using the :focus tag in development, you can do this instead:


# this can be used instead of #run_all_when_everything_filtered
RSpec.configure do |c|
  c.filter_run_when_matching :focus
end

Beware that committing tagged examples to your repository might result in RSpec skipping other tests on your CI! This applies to the explicit :focus tag, as well as its shorthand versions (fit, fdescribe, fcontext). Make sure they don't appear in your repository.

I want to keep tagged examples committed in my repository

If you really want to commit tagged examples to your repository (or it's painful to remove them), you can alternatively make the configuration conditional on the environment:


# Set this environment variable on your CI server:
CI=true

# Then use this in RSpec:
RSpec.configure do |c|
  unless ENV['CI']
    c.filter_run_when_matching :focus
  end
end

This would keep you protected from skipping tests on your CI. It can be useful if you are concerned that someone might mistakenly commit tagged examples into your codebase.

# Queue Mode problems & solutions for knapsack_pro gem
See questions outside of this category

Start using Knapsack Pro

Sign up and speed up your tests.

Get started free