Skip to content

Fix broken RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode. Ignore SPEC_OPTS when generating test examples report for slow test files.#191

Merged
ArturT merged 6 commits intomasterfrom
support-for-spec_opts-queue-mode
Jun 20, 2023
Merged

Fix broken RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode. Ignore SPEC_OPTS when generating test examples report for slow test files.#191
ArturT merged 6 commits intomasterfrom
support-for-spec_opts-queue-mode

Conversation

@ArturT
Copy link
Copy Markdown
Member

@ArturT ArturT commented Apr 20, 2023

problem

Related to the RSpec split by test examples feature.

Some users use SPEC_OPTS to pass options to the RSpec. SPEC_OPTS overrides the options configured by Knapsack Pro.

When SPEC_OPTS is set, then this impacts the options (overrides them) passed to the rake knapsack_pro:rspec_test_example_detector, which is responsible for detecting test examples for slow test files.

solution

We should ignore SPEC_OPTS for the rake knapsack_pro:rspec_test_example_detector to fix the problem with the RSpec split by test examples feature.

related

https://rspec.info/documentation/3.0/rspec-core/RSpec/Core/Configuration.html

The SPEC_OPTS env var overrides the args provided to the RSpec::Core::ConfigurationOptions.new.

support thread

https://groups.google.com/a/knapsackpro.com/g/support/c/6XMMZhIUZNA

story

https://trello.com/c/Et7HS05r

@ArturT ArturT added bug wip Work in progress labels Apr 20, 2023
@ArturT ArturT force-pushed the support-for-spec_opts-queue-mode branch from c26c803 to 1d1945c Compare June 14, 2023 17:08
@ArturT ArturT changed the title Fix broken the RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode Fix broken RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode Jun 19, 2023
… by test examples feature when `SPEC_OPTS` is set in Queue Mode
@ArturT ArturT force-pushed the support-for-spec_opts-queue-mode branch from 1d1945c to c4509be Compare June 19, 2023 17:25
@ArturT ArturT requested a review from 3v0k4 June 19, 2023 18:58
Comment thread CHANGELOG.md Outdated

### 5.1.2

* Fix broken RSpec split by test examples feature when `SPEC_OPTS` is set in Queue Mode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you considered adding a brief explanation on how the fix works? (e.g. ignore SPEC_OPTS, ensure formatter)

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.

ok. Updated the text.

Comment thread lib/tasks/rspec.rake
desc "Generate JSON report for test suite based on default test pattern or based on defined pattern with ENV vars"
task :rspec_test_example_detector do
# ignore the `SPEC_OPTS` options to not affect RSpec execution within this rake task
ENV.delete('SPEC_OPTS')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is run in a shelled out process so it doesn't affect the ENV for other processes?

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.

correct

@ArturT ArturT changed the title Fix broken RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode Fix broken RSpec split by test examples feature when SPEC_OPTS is set in Queue Mode. Ignore SPEC_OPTS when generating test examples report for slow test files. Jun 20, 2023
@ArturT ArturT merged commit bbc4c40 into master Jun 20, 2023
@ArturT ArturT deleted the support-for-spec_opts-queue-mode branch June 20, 2023 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug wip Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants