Using `--bisect` in `SPEC_OPTS` results in infinite loop
Created by: urbanautomaton
Expected behaviour
Using SPEC_OPTS="--bisect"
should work the same as using --bisect
on the command line.
Actual behaviour
RSpec prints its bisection startup message, then continuously spawns new processes and does not terminate.
Steps to reproduce
cat > blah_spec.rb <<EOS
RSpec.describe 'blah' do
it 'is true' do
expect(true).to be_truthy
end
end
EOS
rspec blah_spec.rb --bisect # Works as normal
SPEC_OPTS="--bisect" rspec blah_spec.rb # loops infinitely spawning new rspec instances
Discussion
I'm not sure if this is necessarily a case you'll want to handle, but it was a problem we ran into recently while trying to bisect order-dependent failures from CI. We use a separate test runner, knapsack, to manage parallelisation of our build. Since this controls RSpec invocation, it's frequently necessary to use SPEC_OPTS
to add extra options such as --fail-fast
and --bisect
.
When --bisect
is specified at the command line, RSpec spawns child processes each time it runs a bisect round, removing --bisect
from the original CLI arguments so the child processes don't try to start a new bisection.
When --bisect
is specified in SPEC_OPTS
, however, it's passed through to the child processes, which then start a new bisection, launch more child processes, and so on and so on.
I'd be happy to submit a PR to address this problem, but first wanted to check whether you think it's worth the extra complexity that would be required to support --bisect
via SPEC_OPTS
, or whether this is an option you only want to support as a CLI argument.