.simplecov: delete private method

This commit is contained in:
hyuraku 2021-04-06 22:53:05 +09:00
parent 1dd06e471d
commit d63a0ebd7b

View File

@ -21,6 +21,11 @@ SimpleCov.start do
# be quiet, the parent process will be in charge of output and checking coverage totals
SimpleCov.print_error_status = false
end
excludes = ["test", "vendor"]
subdirs = Dir.chdir(SimpleCov.root) { Dir.glob("*") }
.reject { |d| d.end_with?(".rb") || excludes.include?(d) }
.map { |d| "#{d}/**/*.rb" }.join(",")
files = "#{SimpleCov.root}/{#{subdirs},*.rb}"
if ENV["HOMEBREW_INTEGRATION_TEST"]
# This needs a unique name so it won't be ovewritten
@ -32,8 +37,12 @@ SimpleCov.start do
SimpleCov.at_exit do
# Just save result, but don't write formatted output.
coverage_result = Coverage.result
# TODO: this method is private, find a better way.
SimpleCov.send(:add_not_loaded_files, coverage_result)
coverage_result_dup = coverage_result.dup
Dir[files].each do |file|
absolute_path = File.expand_path(file)
coverage_result_dup[absolute_path] ||= SimpleCov::SimulateCoverage.call(absolute_path)
end
coverage_result = coverage_result_dup
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)
@ -45,14 +54,9 @@ SimpleCov.start do
else
command_name "#{command_name} (#{$PROCESS_ID})"
excludes = ["test", "vendor"]
subdirs = Dir.chdir(SimpleCov.root) { Dir.glob("*") }
.reject { |d| d.end_with?(".rb") || excludes.include?(d) }
.map { |d| "#{d}/**/*.rb" }.join(",")
# Not using this during integration tests makes the tests 4x times faster
# without changing the coverage.
track_files "#{SimpleCov.root}/{#{subdirs},*.rb}"
track_files files
end
add_filter %r{^/build.rb$}