Method: SimpleCov::ResultMerger.merge_results

Defined in:
lib/simplecov/result_merger.rb

.merge_results(*results) ⇒ Object

Merge two or more SimpleCov::Results into a new one with merged coverage data and the command_name for the result consisting of a join on all source result’s names



74
75
76
77
78
79
80
81
# File 'lib/simplecov/result_merger.rb', line 74

def merge_results(*results)
  parsed_results = JSON.parse(JSON.dump(results.map(&:original_result)))
  combined_result = SimpleCov::Combine::ResultsCombiner.combine(*parsed_results)
  result = SimpleCov::Result.new(combined_result)
  # Specify the command name
  result.command_name = results.map(&:command_name).sort.join(", ")
  result
end