Skip to content

Commit

Permalink
Fix another issue with coverage merging
Browse files Browse the repository at this point in the history
Previously, only the first command_name => coverage_data pair of each
result set file was getting merged.
  • Loading branch information
deivid-rodriguez committed Dec 12, 2019
1 parent eaaa020 commit 4d3492d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/simplecov.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ def collate(result_filenames, profile = nil, &block)

results = result_filenames.map do |filename|
# Re-create each included instance of SimpleCov::Result from the stored run data.
SimpleCov::Result.from_hash(JSON.parse(File.read(filename)) || {})
end
(JSON.parse(File.read(filename)) || {}).map do |command_name, coverage|
SimpleCov::Result.from_hash(command_name => coverage)
end
end.flatten

# Use the ResultMerger to produce a single, merged result, ready to use.
@result = SimpleCov::ResultMerger.merge_results(*results)
Expand Down

0 comments on commit 4d3492d

Please sign in to comment.