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

Split spec files to examples programmatically #36

Closed
wants to merge 5 commits into from

Conversation

agis
Copy link
Collaborator

@agis agis commented Sep 21, 2020

Instead of shelling out to rspec, we now split spec files into individual examples programmatically, using the RSpec Core API. This is faster and more robust, since we avoid common shell shenanigans.

Closes #6

@agis agis force-pushed the gh6-split-files-programmatically branch 2 times, most recently from f0b71dc to 2f9ceb5 Compare September 21, 2020 18:51
JSON.parse(out.string)["examples"].map { |e| e["id"] }
ensure
RSpec.configuration.dry_run = dry_run_before
reset_rspec_state!
Copy link
Contributor

Choose a reason for hiding this comment

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

Explain, why do you need to set the original value for the dry_run (only)?

Copy link
Collaborator Author

@agis agis Oct 16, 2020

Choose a reason for hiding this comment

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

Because that's the one we're messing with (we set it to true so that we can fetch the example ids without executing any tests). On the contrary, configuration.files_or_directories_to_run and the formatter we add, are things that will get taken care of by reset_rspec_state!.

test/test_worker.rb Outdated Show resolved Hide resolved
@agis agis force-pushed the gh6-split-files-programmatically branch from 2f9ceb5 to a9c4490 Compare October 11, 2020 11:27
agis added 3 commits October 16, 2020 14:16
Instead of shelling out to rspec, we now split spec files into
individual examples programmatically, using the RSpec Core API. This is
faster and more robust, since we avoid common shell shenanigans.

Closes #6
@agis agis force-pushed the gh6-split-files-programmatically branch from a9c4490 to 1044904 Compare October 16, 2020 11:17
@agis
Copy link
Collaborator Author

agis commented Nov 3, 2020

This causes some failures on our internal builds. Will investigate and do a follow up. Closing it until then.

@agis agis closed this Nov 3, 2020
@fragoulis fragoulis deleted the gh6-split-files-programmatically branch March 18, 2021 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split spec files into examples programmatically
2 participants