[英]SimpleCov: Not run every time, just with rake task
是否有可能在rake任務上運行simplecov coverage-tool而不是每次運行測試時?
您可以使用環境變量解決此問題:
SimpleCov.start if ENV["COVERAGE"]
然后,運行rake test / rspec / cucumber with
$ COVERAGE=true rake test
使用rake任務運行SimpleCov
另一種方法是將設置代碼從規范幫助程序移動到Rakefile
。
# Rakefile
... # normal Rakefile stuff
if defined? RSpec
task(:spec).clear
RSpec::Core::RakeTask.new(:spec) do |t|
require 'simplecov'
SimpleCov.start 'rails'
end
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.