knapsack_pro-ruby icon indicating copy to clipboard operation
knapsack_pro-ruby copied to clipboard

Knapsack v7 ignores run options defined in spec_helpers.

Open mikdiet opened this issue 1 year ago • 2 comments

I'm upgrading Knapsack 6.0.4 -> 7.1.0.

I have a number of tests I don't want to run on CI, they are labeled with :manual tag.

I also have this option in spec/spec_helper.rb:

RSpec.configure do |config|
  ...
  config.filter_run_excluding :manual
  ...
end

Knapsack 6 ignored these tests, I've seen in logs:

Run options: exclude {:manual=>true}

But Knapsack 7 tries to run these tests, and I don't see any "Run options" in logs.

mikdiet avatar May 06 '24 15:05 mikdiet

I didn't change command that runs Knapsack, it looks like

      bundle exec knapsack_pro queue:rspec "\
                        --profile 10 \
                        --format RspecJunitFormatter \
                        --out test_results/rspec.xml \
                        --no-color --format progress \
                        --require rails_helper --require packs/rails/rspec"

mikdiet avatar May 06 '24 16:05 mikdiet

Please exclude tests explicitly when you use the knapsack_pro v7.x gem in Queue Mode.

You can pass --tag ~manual to the knapsack command.

      bundle exec knapsack_pro queue:rspec "\
                        --profile 10 \
                        --format RspecJunitFormatter \
                        --out test_results/rspec.xml \
                        --no-color --format progress \
                        --tag ~manual \
                        --require rails_helper --require packs/rails/rspec"

It is useful if you want to exclude only a subset of test examples within a test file.

If you want to exclude all test examples from the given test file, it is better to exclude a whole test file instead of tagged test examples. You can use KNAPSACK_PRO_TEST_FILE_EXCLUDE_PATTERN so that the excluded test files are not loaded and not distributed between parallel nodes.

ArturT avatar May 06 '24 17:05 ArturT

Thank you, it helped a lot!

mikdiet avatar May 07 '24 10:05 mikdiet