brew/Library/Homebrew/.simplecov

71 lines
2.3 KiB
Plaintext
Raw Normal View History

2016-08-21 07:51:25 +02:00
#!/usr/bin/env ruby
require "English"
2016-09-25 00:51:09 +02:00
SimpleCov.start do
coverage_dir File.expand_path("../test/coverage", File.realpath(__FILE__))
root File.expand_path("..", File.realpath(__FILE__))
# We manage the result cache ourselves and the default of 10 minutes can be
# too low (particularly on Travis CI), causing results from some integration
# tests to be dropped. This causes random fluctuations in test coverage.
merge_timeout 86400
if ENV["HOMEBREW_INTEGRATION_TEST"]
2016-09-25 00:51:09 +02:00
command_name "#{ENV["HOMEBREW_INTEGRATION_TEST"]} (#{$PROCESS_ID})"
at_exit do
2016-09-25 00:51:09 +02:00
exit_code = $ERROR_INFO.nil? ? 0 : $ERROR_INFO.status
$stdout.reopen("/dev/null")
# Just save result, but don't write formatted output.
coverage_result = Coverage.result
SimpleCov.add_not_loaded_files(coverage_result)
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)
exit! exit_code
end
else
2016-09-25 00:51:09 +02:00
command_name "#{command_name} (#{$PROCESS_ID})"
subdirs = Dir.chdir(SimpleCov.root) { Dir.glob("*") }
.reject { |d| d.end_with?(".rb") || ["test", "vendor"].include?(d) }
.map { |d| "#{d}/**/*.rb" }.join(",")
2017-10-08 14:14:15 +02:00
# Not using this during integration tests makes the tests 4x times faster
# without changing the coverage.
track_files "#{SimpleCov.root}/{#{subdirs},*.rb}"
2016-01-27 22:03:17 +01:00
end
add_filter %r{^/build.rb$}
add_filter %r{^/config.rb$}
add_filter %r{^/constants.rb$}
add_filter %r{^/postinstall.rb$}
add_filter %r{^/test.rb$}
add_filter %r{^/compat/}
add_filter %r{^/dev-cmd/tests.rb$}
add_filter %r{^/test/}
add_filter %r{^/vendor/}
require "rbconfig"
add_filter %r{^/os/mac/} unless RbConfig::CONFIG["host_os"].include?("darwin")
unless RbConfig::CONFIG["host_os"].include?("linux")
add_filter %r{^/os/linux/}
end
# Add groups and the proper project name to the output.
project_name "Homebrew"
add_group "Cask", %r{^/cask/}
add_group "Commands", [%r{/cmd/}, %r{^/dev-cmd/}]
add_group "Extensions", %r{^/extend/}
add_group "OS", [%r{^/extend/os/}, %r{^/os/}]
add_group "Requirements", %r{^/requirements/}
add_group "Scripts", [
%r{^/brew.rb$},
%r{^/build.rb$},
%r{^/postinstall.rb$},
%r{^/test.rb$},
]
end