Merge pull request #11047 from hyuraku/simplecov_delete_private_method

.simplecov: delete private method
This commit is contained in:
Mike McQuaid 2021-04-13 14:47:09 +01:00 committed by GitHub
commit 586d25a522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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) { Pathname.glob("*") }
.reject { |p| p.extname == ".rb" || excludes.include?(p.to_s) }
.map { |p| "#{p}/**/*.rb" }.join(",")
files = "#{SimpleCov.root}/{#{subdirs},*.rb}"
if ENV["HOMEBREW_INTEGRATION_TEST"]
# This needs a unique name so it won't be ovewritten
@ -31,9 +36,11 @@ 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 = Coverage.result.dup
Dir[files].each do |file|
absolute_path = File.expand_path(file)
coverage_result[absolute_path] ||= SimpleCov::SimulateCoverage.call(absolute_path)
end
simplecov_result = SimpleCov::Result.new(coverage_result)
SimpleCov::ResultMerger.store_result(simplecov_result)
@ -45,14 +52,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$}