Use new Undercover formatter for :nocov: support

This commit is contained in:
Maikel Linke
2025-07-30 12:49:27 +10:00
parent d72bc49409
commit c0924fbe5e
6 changed files with 8 additions and 10 deletions

View File

@@ -16,6 +16,7 @@ AllCops:
- node_modules/**/*
# Excluding: inadequate Naming/FileName rule rejects GemFile name with camelcase
- engines/web/Gemfile
- .undercover
Bundler/DuplicatedGem:
Enabled: false

View File

@@ -1,5 +1,4 @@
#!/bin/env ruby
# frozen_string_literal: true
-l coverage/lcov/openfoodnetwork.lcov
-c master
-c master

View File

@@ -172,8 +172,6 @@ end
group :test do
gem 'pdf-reader'
gem 'rails-controller-testing'
gem 'simplecov', require: false
gem 'simplecov-lcov', require: false
gem 'undercover', require: false
gem 'vcr', require: false
gem 'webmock', require: false

View File

@@ -746,7 +746,6 @@ GEM
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
spreadsheet_architect (5.0.0)
caxlsx (>= 3.3.0, < 4)
@@ -991,8 +990,6 @@ DEPENDENCIES
shoulda-matchers
sidekiq
sidekiq-scheduler
simplecov
simplecov-lcov
spreadsheet_architect
spring
spring-commands-rspec

View File

@@ -5,7 +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"
require "undercover/simplecov_formatter"
path_to_results = args[:path_to_results].presence || "tmp/simplecov"
output_path = args[:coverage_dir].presence || "coverage"
@@ -15,9 +15,8 @@ namespace :simplecov do
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)
formatter(SimpleCov::Formatter::Undercover)
coverage_dir(output_path)
end
end

View File

@@ -26,6 +26,10 @@ RSpec.describe "simplecov.rake" do
and change { File.exist?(File.join(output_dir, "index.html")) }.
from(false).
to(true).
and change { File.exist?(File.join(output_dir, "coverage.json")) }.
from(false).
to(true)
end
end