-
Notifications
You must be signed in to change notification settings - Fork 377
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apply simplecov fix in an overlay patch
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Overlay patch fix for https://github.com/simplecov-ruby/simplecov/pull/972. | ||
# | ||
# simplecov supports branch coverage only on some Ruby runtimes (for example, | ||
# not on JRuby). However, when merging coverage reports across runs, | ||
# simplecov assumes that branch coverage is always present. | ||
# This causes merging to fail when the runs are on different Ruby runtimes | ||
# as well as when merging on JRuby. | ||
# | ||
# Upstream has not fixed the issue in 3+ years (PR opened in 2021). | ||
# | ||
# dd-trace-rb has been using a fork of simplecov with this fix, however | ||
# this is awkward because bundler insists on constantly installing the fork | ||
# even though nothing in it or related to it changed. | ||
# | ||
# This file now brings the patch into our tree, permitting us to use any | ||
# released version of simplecov and removing the need to reference a fork. | ||
|
||
module SimpleCovCombineFix | ||
def combine(coverage_a, coverage_b) | ||
super.tap do |result| | ||
if SimpleCov.branch_coverage? | ||
result['branches'] ||= {} | ||
end | ||
end | ||
end | ||
end | ||
|
||
class << SimpleCov::Combine::FilesCombiner | ||
prepend(SimpleCovCombineFix) | ||
end |