tests: simplify SimpleCov configuration (#348)

There is no good reason to configure the options specific to integration
tests in a completely different location from all other options.
This commit is contained in:
Martin Afanasjew 2016-06-14 14:54:16 +02:00 committed by GitHub
parent 92f51abf59
commit 86538c9d6a

View File

@ -13,9 +13,17 @@ SimpleCov.start do
add_filter "Homebrew/vendor/"
add_filter "Taps/"
# Not using this during integration tests makes the tests 4x times faster
# without changing the coverage.
unless ENV["HOMEBREW_INTEGRATION_TEST"]
if ENV["HOMEBREW_INTEGRATION_TEST"]
command_name ENV["HOMEBREW_INTEGRATION_TEST"]
at_exit do
exit_code = $!.nil? ? 0 : $!.status
$stdout.reopen("/dev/null")
SimpleCov.result # Just save result, but don't write formatted output.
exit! exit_code
end
else
# Not using this during integration tests makes the tests 4x times faster
# without changing the coverage.
track_files "#{SimpleCov.root}/**/*.rb"
end
@ -33,16 +41,6 @@ SimpleCov.start do
]
end
if ENV["HOMEBREW_INTEGRATION_TEST"]
SimpleCov.command_name ENV["HOMEBREW_INTEGRATION_TEST"]
SimpleCov.at_exit do
exit_code = $!.nil? ? 0 : $!.status
$stdout.reopen("/dev/null")
SimpleCov.result # Just save result, but don't write formatted output.
exit! exit_code
end
end
# Don't use Coveralls outside of CI, as it will override SimpleCov's default
# formatter causing the `index.html` not to be written once all tests finish.
if RUBY_VERSION.split(".").first.to_i >= 2 && !ENV["HOMEBREW_INTEGRATION_TEST"] && ENV["CI"]