From c0924fbe5ee53d85ff66264674a12e8c71b53529 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Wed, 30 Jul 2025 12:49:27 +1000 Subject: [PATCH] Use new Undercover formatter for :nocov: support --- .rubocop_styleguide.yml | 1 + .undercover | 3 +-- Gemfile | 2 -- Gemfile.lock | 3 --- lib/tasks/simplecov.rake | 5 ++--- spec/lib/tasks/simplecov_spec.rb | 4 ++++ 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.rubocop_styleguide.yml b/.rubocop_styleguide.yml index b82dbada1e..91c745cdd9 100644 --- a/.rubocop_styleguide.yml +++ b/.rubocop_styleguide.yml @@ -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 diff --git a/.undercover b/.undercover index 95a9fe08c9..9b7d04fdb9 100644 --- a/.undercover +++ b/.undercover @@ -1,5 +1,4 @@ #!/bin/env ruby # frozen_string_literal: true --l coverage/lcov/openfoodnetwork.lcov --c master \ No newline at end of file +-c master diff --git a/Gemfile b/Gemfile index 342f6ec61e..a10912faba 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock index 321fcbd450..60fc57e87f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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 diff --git a/lib/tasks/simplecov.rake b/lib/tasks/simplecov.rake index d5bc344f06..cc7f5c95e6 100644 --- a/lib/tasks/simplecov.rake +++ b/lib/tasks/simplecov.rake @@ -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 diff --git a/spec/lib/tasks/simplecov_spec.rb b/spec/lib/tasks/simplecov_spec.rb index 68e9d0bc5e..62204b12ef 100644 --- a/spec/lib/tasks/simplecov_spec.rb +++ b/spec/lib/tasks/simplecov_spec.rb @@ -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