Skip to content

Commit

Permalink
Merge pull request #18639 from Homebrew/improve_parallel_tests
Browse files Browse the repository at this point in the history
spec_helper: improve parallel test handling.
  • Loading branch information
Bo98 authored Oct 27, 2024
2 parents e4fb339 + 46cb9ec commit 91f3671
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Library/Homebrew/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@
]
SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(formatters)

if RUBY_PLATFORM[/darwin/] && ENV["TEST_ENV_NUMBER"]
# Needed for outputting coverage reporting only once for parallel_tests.
# Otherwise, "Coverage report generated" will get spammed for each process.
if ENV["TEST_ENV_NUMBER"]
SimpleCov.at_exit do
result = SimpleCov.result
result.format! if ParallelTests.number_of_running_processes <= 1
# `SimpleCov.result` calls `ParallelTests.wait_for_other_processes_to_finish`
# internally for you on the last process.
result.format! if ParallelTests.last_process?
end
end
end
Expand Down

0 comments on commit 91f3671

Please sign in to comment.