You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When splitting rspec across multiple workers using something like knapsack, what would be the best way to club all generated coverage reports into a single artifact?
The text was updated successfully, but these errors were encountered:
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'simplecov'
require 'simplecov-lcov'
puts('Merging coverage results from parallel CircleCI tests containers into a single LCOV report...')
SimpleCov.collate(Dir['/home/circleci/rspec/*.resultset.json']) do
enable_coverage(:branch)
end
report_path = ARGV[0] || 'coverage.lcov'
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov::Formatter::LcovFormatter.config.single_report_path = report_path
merged_result = SimpleCov.result
merged_result.format!
if File.size(report_path).zero?
puts('Written report has 0 bytes')
exit 1
end
puts("Done! LCOV saved to #{SimpleCov::Formatter::LcovFormatter.config.single_report_path}")
Depending on which CI you use, you'd need a script like this to run after all the workers have finished and then feed the merged coverage report to undercover.
When splitting rspec across multiple workers using something like knapsack, what would be the best way to club all generated coverage reports into a single artifact?
The text was updated successfully, but these errors were encountered: