Skip to content

Commit

Permalink
spec_helper: improve parallel test handling.
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
MikeMcQuaid committed Oct 26, 2024
1 parent 59d56f8 commit 92fee90
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Library/Homebrew/test/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 92fee90

Please sign in to comment.