Avoid starting Coverage twice
What does this MR do and why?
Avoid starting Coverage twice
Starting Coverage twice can cause errors in Ruby 3.1 and Ruby 3.2
The error looks like this:
An error occurred while loading spec_helper.
Failure/Error: config.register
Tooling::Crystalball::CoverageLinesStrategy.new(execution_detector)
RuntimeError:
coverage measurement is already setup
./tooling/lib/tooling/crystalball/coverage_lines_strategy.rb:19:in
`start'
./tooling/lib/tooling/crystalball/coverage_lines_strategy.rb:19:in
`after_register'
This only happens when all the following conditions meet:
- SIMPLECOV=true
- CRYSTALBALL=true
- Ruby 3.1 or Ruby 3.2
This means it hits mostly only in scheduled pipelines on the default branch because we set CRYSTALBALL=true for that.
How to set up and validate locally
Run any RSpec with env SIMPLECOV=true CRYSTALBALL=true
and with Ruby 3.1 or Ruby 3.2. This cannot be produced by Ruby 3.0.
Related to #436668 (closed)
Edited by Lin Jen-Shin