Changes rake task to include merging of the lcov result files

This commit is contained in:
filipefurtad0
2025-06-25 13:51:09 +01:00
parent 5b7675cd9b
commit 4cb9d870b4

View File

@@ -5,6 +5,7 @@ namespace :simplecov do
task :collate_results, # rubocop:disable Rails/RakeEnvironment doesn't need the full env
[:path_to_results, :coverage_dir] do |_t, args|
require "simplecov"
require "simplecov-lcov"
path_to_results = args[:path_to_results].presence || "tmp/simplecov"
output_path = args[:coverage_dir].presence || "coverage"
@@ -13,5 +14,11 @@ namespace :simplecov do
formatter(SimpleCov::Formatter::HTMLFormatter)
coverage_dir(output_path)
end
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
SimpleCov.collate Dir[File.join(path_to_results, "**", ".resultset.json")], "rails" do
formatter(SimpleCov::Formatter::LcovFormatter)
coverage_dir(output_path)
end
end
end