Better Rubymine compatibility for .simplecov
Rubymine's code coverage tools separate collection from reporting so that multiple runs can have their data merged. To separate, collecting from reporting, SimpleCov.start is only run when not using Rubymine (as indicated by a lack of the RM_INFO environment variable). This way, `rake spec` will collect coverage info and generate the report as before, but Rubymine will only collect coverage when using 'Run ... with coverage enabled' button and will only generate a report when using 'Generate Coverage Report' as is the intended behavior in Rubymine.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# RM_INFO is set when using Rubymine. In Rubymine, starting SimpleCov is
|
||||
# controlled by running with coverage, so don't explicitly start coverage (and
|
||||
# therefore generate a report) when in Rubymine. This _will_ generate a report
|
||||
# whenever `rake spec` is run.
|
||||
unless ENV['RM_INFO']
|
||||
SimpleCov.start
|
||||
end
|
||||
|
||||
SimpleCov.configure do
|
||||
# ignore this file
|
||||
add_filter '.simplecov'
|
||||
|
||||
@@ -11,12 +11,6 @@ $LOAD_PATH.unshift(lib_pathname.to_s)
|
||||
# must be first require and started before any other requires so that it can measure coverage of all following required
|
||||
# code. It is after the rubygems and bundler only because Bundler.setup supplies the LOAD_PATH to simplecov.
|
||||
require 'simplecov'
|
||||
# Ensure the coverage directory is always the same no matter where the individual spec is in the hierarchy when using
|
||||
# Rubymine to run one spec.
|
||||
#
|
||||
# @see https://github.com/colszowka/simplecov/issues/95
|
||||
SimpleCov.root(root_pathname)
|
||||
SimpleCov.start
|
||||
|
||||
require 'rspec/core'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user