next_rails
next_rails copied to clipboard
Add dual_run command
Description
This PR fixes https://github.com/fastruby/next_rails/issues/111
We can now run the same command in the two versions in parallel, like: dual_run bundle exec rspec spec/models
.
The output of that in a project would be this for example:
Running in parallel:
BUNDLE_GEMFILE=Gemfile.next bundle exec rspec spec/models/
bundle exec rspec spec/models/
next results
================================================================================
Randomized with seed 41263
...................
Finished in 0.25773 seconds (files took 4.02 seconds to load)
19 examples, 0 failures
Randomized with seed 41263
(waiting for current command to finish)
current results
================================================================================
Randomized with seed 40666
...................
Finished in 0.23505 seconds (files took 3.96 seconds to load)
19 examples, 0 failures
Randomized with seed 40666
Motivation and Context
This command solves 2 problems:
- we can run the same test for example in parallel instead of sequentially, to save time
- we can run them in the same terminal
How Has This Been Tested?
To test this, you can add this branch as a gem in the Gemfile:
gem "next_rails", github: "fastruby/next_rails", branch: "add-dual-run-command"
Then bundle both:
bundle update next_rails
BUNDLE_GEMFILE=Gemfile.next bundle update next_rails
Now, in the root of the project, the dual_run
command should be available:
dual_run bundle exec rspec spec/models
I'm not really sure how would I test this with automated tests.
I will abide by the code of conduct
This seems useful, I'll have a look soon, thanks for contributing 🚀
Should we modify the changelog?
@arielj, I followed How Has This Been Tested?
steps to set it up but I got the following:
(venv) ➜ fastruby.io git:(BLOG-283) ✗ dual_run bundle exec rspec spec/models
zsh: command not found: dual_run