From 10697d4e2eeb173f68accabec25b705f805fd1dc Mon Sep 17 00:00:00 2001 From: Eric Date: Sat, 29 Jun 2024 14:36:31 +0200 Subject: [PATCH] simplecov libraries are now require false simplecov required at top of spec_helper.rb Use simplecov configuration file lcov will be used only on CI, default is a html remove duplicate warnings in spec_helper remove some $LOAD_PATH.unshift( at top of spec_helper --- .simplecov | 15 +++++++++++++++ Gemfile | 4 ++-- spec/spec_helper.rb | 18 +----------------- 3 files changed, 18 insertions(+), 19 deletions(-) create mode 100644 .simplecov diff --git a/.simplecov b/.simplecov new file mode 100644 index 0000000000..dd8c5cd4d8 --- /dev/null +++ b/.simplecov @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +if ENV['GITHUB_USER'] # only when running CI + require 'simplecov-lcov' + SimpleCov::Formatter::LcovFormatter.config do |c| + c.report_with_single_file = true + c.single_report_path = 'coverage/lcov.info' + end + + SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter +end + +SimpleCov.start do + add_filter '/spec/' +end diff --git a/Gemfile b/Gemfile index eaf603c1d2..8df676a001 100644 --- a/Gemfile +++ b/Gemfile @@ -28,8 +28,8 @@ group :test do gem 'rack-test', '~> 2.1' gem 'rspec', '~> 3.13' gem 'ruby-grape-danger', '~> 0.2', require: false - gem 'simplecov', '~> 0.21' - gem 'simplecov-lcov', '~> 0.8' + gem 'simplecov', '~> 0.21', require: false + gem 'simplecov-lcov', '~> 0.8', require: false gem 'test-prof', require: false end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index af3ff82566..1589a0881d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,15 +1,10 @@ # frozen_string_literal: true -$LOAD_PATH.unshift(File.dirname(__FILE__)) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) -$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'support')) - +require 'simplecov' require 'rubygems' require 'bundler' Bundler.require :default, :test -require 'grape' - Grape.deprecator.behavior = :raise %w[config support].each do |dir| @@ -27,7 +22,6 @@ config.include Spec::Support::Helpers config.raise_errors_for_deprecations! config.filter_run_when_matching :focus - config.warnings = true config.before(:all) { Grape::Util::InheritableSetting.reset_global! } config.before { Grape::Util::InheritableSetting.reset_global! } @@ -35,13 +29,3 @@ # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = '.rspec_status' end - -require 'simplecov' -require 'simplecov-lcov' -SimpleCov::Formatter::LcovFormatter.config do |c| - c.report_with_single_file = true - c.single_report_path = 'coverage/lcov.info' -end - -SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter -SimpleCov.start