1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Create an lcov file for coverage instead of the automatic simplecov formatter for coveralls

This commit is contained in:
Holger Just 2020-07-23 16:29:34 +02:00
parent 80b93b1f14
commit 718e2c026a
2 changed files with 20 additions and 6 deletions

View File

@ -13,7 +13,11 @@ gem 'rake'
group :test do group :test do
gem 'rspec', '~> 3.0' gem 'rspec', '~> 3.0'
gem 'coveralls', '~> 0.8.20'
if Gem.ruby_version >= Gem::Version.new('2.4.0')
gem 'simplecov', '~> 0.18'
gem 'simplecov-lcov', '~> 0.8'
end
gem 'rack', ENV['RACK_VERSION'] ? "~> #{ENV['RACK_VERSION']}" : nil gem 'rack', ENV['RACK_VERSION'] ? "~> #{ENV['RACK_VERSION']}" : nil
end end

View File

@ -6,13 +6,23 @@
# of the MIT license. See the LICENSE.txt file for details. # of the MIT license. See the LICENSE.txt file for details.
if ENV['COVERAGE'].to_s == 'true' if ENV['COVERAGE'].to_s == 'true'
if Gem.ruby_version <= Gem::Version.new('2.4.0')
STDERR.puts "Simplecov requires Ruby 2.4, but we are currently on " \
"#{RUBY_VERSION}. Try running the spec again without collecting " \
"coverage details (by leaving the COVERAGE environment variable empty) " \
"or by using a newer Ruby version."
exit 1
end
require 'simplecov' require 'simplecov'
if ENV['CI'] == 'true' if ENV['CI'].to_s == 'true'
require 'coveralls' require 'simplecov-lcov'
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
Coveralls::SimpleCov::Formatter SimpleCov.formatters = [
SimpleCov::Formatter::HTMLFormatter,
SimpleCov::Formatter::LcovFormatter
] ]
else else
SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter