From 92fee908ba0947768070272e3d16b194ddfec0af Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 26 Oct 2024 11:20:37 +0100 Subject: [PATCH] spec_helper: improve parallel test handling. - Clarify the comment of why we have SimpleCov special logic for parallel tests - use a nicer ParallelTests API for checking which process to output the coverage format on --- Library/Homebrew/test/spec_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 783b522b9664e..fb2922c6999dc 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -10,10 +10,11 @@ ] SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters) + # Needed for outputting coverage reporting only once for parallel_tests if RUBY_PLATFORM[/darwin/] && ENV["TEST_ENV_NUMBER"] SimpleCov.at_exit do result = SimpleCov.result - result.format! if ParallelTests.number_of_running_processes <= 1 + result.format! if ParallelTests.last_process? end end end