2

I have a Ruby on Rails 6.1 application I am testing with rspec 3.10, all tests passing and it exits with code 0. When I add Simplecov (using 0.21.2) the exit code is always 1.

My simplecov configuration:

# spec/rails_helper.rb
require 'simplecov'
if !ENV["NO_COVERAGE"]
    SimpleCov.start :rails do
        minimum_coverage 0
        minimum_coverage_by_file 0
        filesize = Proc.new { |source_file| source_file.lines.count < 10 }
        add_group "Workers", "/app/workers"
        add_group "Builders", "/app/builders"
        add_group "Queries", "/app/queries"
        add_group "Decorators", "/app/decorators"
    end
end

Example output (from a Github action)

Finished in 4 minutes 18.1 seconds (files took 11.15 seconds to load)
2415 examples, 0 failures, 154 pending

Randomized with seed 29170

Coverage report generated for RSpec to /app/coverage. 8665 / 13736 LOC (63.08%) covered.
1
Error: Process completed with exit code 1.

If I remove or disable simplecov everything works fine. If I turn it back on, exit code is always 1. This happens on GH Actions, my dev machine and inside Docker containers.

Am I doing something wrong? How do I get simplecov to always return 0 since I don't care about minimum coverage anyway?

Nick M
  • 2,424
  • 5
  • 34
  • 57

0 Answers0