BigW Consortium Gitlab

merge-simplecov 594 Bytes
Newer Older
1 2
#!/usr/bin/env ruby

3 4
require_relative '../spec/simplecov_env'
SimpleCovEnv.configure_profile
5

6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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
26 27 28 29
    end
  end
end

30
SimpleCov::ResultMerger.merged_result.format!