Skip to content

Commit

Permalink
allow Coverage to start when Coverage.running? is not implemented (#1043
Browse files Browse the repository at this point in the history
)
  • Loading branch information
notEthan authored Apr 15, 2024
1 parent 99c0040 commit 0c27173
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def start_coverage_measurement
if coverage_start_arguments_supported?
start_coverage_with_criteria
else
Coverage.start unless Coverage.running?
Coverage.start unless coverage_running?
end
end

Expand All @@ -353,7 +353,13 @@ def start_coverage_with_criteria

start_arguments[:eval] = true if coverage_for_eval_enabled?

Coverage.start(start_arguments) unless Coverage.running?
Coverage.start(start_arguments) unless coverage_running?
end

def coverage_running?
# for ruby versions which do not implement Coverage.running?,
# Coverage.start may be called multiple times without raising.
Coverage.respond_to?(:running?) && Coverage.running?
end

CRITERION_TO_RUBY_COVERAGE = {
Expand Down

0 comments on commit 0c27173

Please sign in to comment.