diff --git a/.simplecov b/.simplecov index 088c128..6117940 100644 --- a/.simplecov +++ b/.simplecov @@ -1,12 +1,32 @@ # frozen_string_literal: true -SimpleCov.start do - root ENV.fetch("ENGINE_ROOT", nil) +if ENV["SIMPLECOV"] + SimpleCov.start do + # `ENGINE_ROOT` holds the name of the engine we are testing. + # This brings us to the main Decidim folder. + root ENV.fetch("ENGINE_ROOT", nil) - add_filter "lib/decidim/apiauth/version.rb" - add_filter "/spec" -end + # We make sure we track all Ruby files, to avoid skipping unrequired files + # We need to include the `../` section, otherwise it only tracks files from the + # `ENGINE_ROOT` folder for some reason. + track_files "**/*.rb" + + # We ignore some of the files because they are never tested + add_filter "/config/" + add_filter "/db/" + add_filter "/vendor/" + add_filter "/spec/" + add_filter "/test/" + add_filter %r{^/lib/decidim/[^/]*/engine.rb} + add_filter %r{^/lib/decidim/[^/]*/admin_engine.rb} + add_filter %r{^/lib/decidim/[^/]*/component.rb} + add_filter %r{^/lib/decidim/[^/]*/participatory_space.rb} + end -SimpleCov.command_name ENV.fetch("COMMAND_NAME", nil) || File.basename(Dir.pwd) + SimpleCov.merge_timeout 1800 -SimpleCov.merge_timeout 1800 + if ENV["CI"] + require "simplecov-cobertura" + SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter + end +end diff --git a/Gemfile b/Gemfile index 1249e40..5a77d48 100644 --- a/Gemfile +++ b/Gemfile @@ -34,7 +34,3 @@ group :development do gem "spring-watcher-listen", "~> 2.0" gem "web-console", "~> 3.5" end - -group :test do - gem "codecov", require: false -end diff --git a/Gemfile.lock b/Gemfile.lock index d1d9737..be4f630 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -135,8 +135,6 @@ GEM chef-utils (18.2.7) concurrent-ruby childprocess (4.1.0) - codecov (0.6.0) - simplecov (>= 0.15, < 0.22) coercible (1.0.0) descendants_tracker (~> 0.0.1) coffee-rails (5.0.0) @@ -820,7 +818,6 @@ PLATFORMS DEPENDENCIES bootsnap (~> 1.4) byebug (~> 11.0) - codecov decidim (~> 0.27.0) decidim-apiauth! decidim-dev (~> 0.27.0) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e74c150..1c6c02e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,13 +2,6 @@ require "decidim/dev" -require "simplecov" -SimpleCov.start "rails" -if ENV["CODECOV"] - require "codecov" - SimpleCov.formatter = SimpleCov::Formatter::Codecov -end - ENV["ENGINE_ROOT"] = File.dirname(__dir__) Decidim::Dev.dummy_app_path =