Skip to content

Instantly share code, notes, and snippets.

@mtylty
Last active November 24, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtylty/42449942ee917c03c44fde21c30747aa to your computer and use it in GitHub Desktop.
Save mtylty/42449942ee917c03c44fde21c30747aa to your computer and use it in GitHub Desktop.
merge_simplecov
#!/usr/bin/env ruby
require_relative 'spec/support/simplecov'
module SimpleCov
module ResultMerger
class << self
def resultset_files
Dir.glob(File.join(SimpleCov.coverage_path, '*', '.resultset.json'))
end
def resultset_hashes
resultset_files.map do |path|
begin
JSON.parse(File.read(path))
rescue
{}
end
end
end
def resultset
resultset_hashes.reduce({}, :merge)
end
end
end
end
SimpleCov::ResultMerger.merged_result.format!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment