Last active
November 24, 2017 14:26
-
-
Save mtylty/42449942ee917c03c44fde21c30747aa to your computer and use it in GitHub Desktop.
merge_simplecov
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
#!/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