Skip to content

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
ArturT merged 7 commits intomasterfrom
no_tag_option_when_rspec_split_by_test_examples
Jul 8, 2021
Merged

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
ArturT merged 7 commits intomasterfrom
no_tag_option_when_rspec_split_by_test_examples

Conversation

@ArturT
Copy link
Copy Markdown
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
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
Copy Markdown
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
Copy Markdown
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