我有一个 Ruby on Rails 6.1 应用程序,我正在使用 rspec 3.10 进行测试,所有测试都通过并以代码 0 退出。当我添加 Simplecov(使用 0.21.2)时,退出代码始终为 1。
我的 simplecov 配置:
# 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
示例输出(来自 Github 操作)
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.
如果我删除或禁用 simplecov,一切正常。如果我重新打开它,退出代码始终为 1。这发生在 GH Actions、我的开发机器和 Docker 容器内。
难道我做错了什么?由于我不关心最小覆盖率,如何让 simplecov 始终返回 0?