From d63a0ebd7b2121ae72671ab89da15735619b0c4a Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Tue, 6 Apr 2021 22:53:05 +0900 Subject: [PATCH] .simplecov: delete private method --- Library/Homebrew/.simplecov | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/.simplecov b/Library/Homebrew/.simplecov index a18bd3501c..be9aad12f1 100755 --- a/Library/Homebrew/.simplecov +++ b/Library/Homebrew/.simplecov @@ -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$}