Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow to use the RSpec tag option together with the RSpec split by test examples feature in knapsack_pro gem in Regular Mode #148

Merged
merged 7 commits into from
Jul 8, 2021

Conversation

ArturT
Copy link
Member

@ArturT ArturT commented Jul 8, 2021

Why don't allow to use RSpec tag option with RSpec split by test examples feature?
https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it#warning-dont-use-rspec-tag-option

If you do it and you use at the same time KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES=true then --tag option might not be respected by RSpec due to a bug in the RSpec. RSpec has a higher priority to run test examples like spec/a_spec.rb[1:1] than respect the --tag option. This can result in running test cases that you didn't intend to run.

solution

We raise an exception when the user uses RSpec tag option at the same time with RSpec split by test examples feature to warn him.

related

We already implemented such an exception for Queue Mode in #139

ArturT added 6 commits July 8, 2021 16:16
…amples feature at the same time for Regular Mode as well
…ready tested for ensure_no_tag_option_when_rspec_split_by_test_examples_enabled! method.

This test is integration test to verify that args in string format --tag example-value will be translated to cli_args array that is understood by  ensure_no_tag_option_when_rspec_split_by_test_examples_enabled! method
let(:args) { '--tag example-value' }

it do
expect { subject }.to raise_error(/It is not allowed to use the RSpec tag option together with the RSpec split by test examples feature/)
end
end

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One general integration test is enough, so I removed below test cases as they are covered for ensure_no_tag_option_when_rspec_split_by_test_examples_enabled! method spec now.

@ArturT ArturT requested a review from shadre July 8, 2021 15:00
Copy link
Member

@shadre shadre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 👍

@ArturT ArturT merged commit e7583bb into master Jul 8, 2021
@ArturT ArturT deleted the no_tag_option_when_rspec_split_by_test_examples branch July 8, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants