Repository navigation
Fix unloaded files merge - #436
Closed
hugopeixoto wants to merge 2 commits into
Closed
hugopeixoto wants to merge 2 commits into
hugopeixoto wants to merge 2 commits into
Conversation
When merging two test suites, it might be the case that some files are loaded by one suite and not loaded by the other one. Whenever this happens, the "never" lines from the test suite that loaded the file should trump the "uncovered" lines from the test suite that didn't. This commit solves that by giving higher precedence to `nil` values when merging.
Collaborator
|
I'm not familiar enough to review this properly - the model seems weird but this change seems reasonable without a more extensive refactoring (if that's even appropriate). Will wait for either someone else to chime in or a confirmation that this has fixed #433 before merging. Thank you! |
Contributor
There was a problem hiding this comment.
Why did you change the existing behavior?
This will occur a problem when we run the tests in parallel. Because covered line become a disabled line.
|
Just FYI there’s a different fix for the same issue: diff --git i/lib/simplecov/merge_helpers.rb w/lib/simplecov/merge_helpers.rb
index 339210d1..ca6b8a9f 100644
--- i/lib/simplecov/merge_helpers.rb
+++ w/lib/simplecov/merge_helpers.rb
@@ -2,6 +2,12 @@ module SimpleCov
module ArrayMergeHelper
# Merges an array of coverage results with self
def merge_resultset(array)
+ # Don't merge with all-zero array to preserve nil values from actual runs.
+ if size == array.size
+ return array.dup if all? { |el| el == 0 }
+ return dup if array.all? { |el| el == 0 }
+ end
+
new_array = dup
array.each_with_index do |element, i|
if element.nil? && new_array[i].nil? |
Collaborator
|
Closing in favour of #441 |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A test case and an attempt at fixing #433