簡體   English   中英

SimpleCov:不是每次都運行,只是使用rake任務

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM