Rspec provides the handy ability to
place focus: true
by a test to make it run in isolation. And running
$bundle exec rspec spec
works to make this functionality true
However, usage of parallel specs alone
$rake parallel:spec
or with Zeus : $zeus rake parallel:spec
does not work at all and results in the following
ignoring {:focus => true}
Why? I do not want it to be ignored!
Is there no way to run a single test or even a single file while using parallel specs? Trying to get it set up and debug errors that have to do with parallel processing, but I don't want to have to run the entire test suite to test a fix.
Specifying the file location afterwards such as
$zeus rake parallel:spec spec/features/testing_questionnaire_submission_spec.rb
also fails to work.
This is a good question, and I have the same issue with parallel_tests in my configuration. As parallel_tests breaks the files into separate threads, it will not be of any benefit to run a single file multi-thread anyway.
You can see this when you run:
parallel_rspec spec/models/some_test.rb
It will say 1 processes for 1 specs, ~ 1 specs per process
.
Thus, if you want to run a single spec in some_test.rb
, use :focus
for that it
or specify
block, and then run,
rspec spec/models/some_test.rb
or
parallel_rspec spec/models/some_test.rb
it doesn't matter. If you want to run a single spec file, it's the same command just no :focus
.
The issue that needs to be fixed is when parallel_rspec
is run and there is a :focus
somewhere in the tests, it should just run that one spec. Instead, it seems to run every spec in every thread except for the thread that includes the :focus
, where it only runs that one test in that thread.
And you can see here, I don't think that this issue is going to get fixed: https://github.com/grosser/parallel_tests/issues/114