Skip to content

Commit

Permalink
Merge pull request #220 from Shopify/rwstauner/reporters-overwritten
Browse files Browse the repository at this point in the history
Verify that internal reporters are preserved
  • Loading branch information
rwstauner committed Jun 14, 2023
2 parents be318d3 + 4e40758 commit dd2388f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ruby/lib/minitest/queue/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,36 @@ def run_command
load_tests
populate_queue
end

at_exit {
verify_reporters!(reporters)
}
# Let minitest's at_exit hook trigger
end

def verify_reporters!(reporters)
return unless reporters.any? { |r| !Minitest::Reporters.reporters.include?(r) }

warn <<~WARNING
WARNING!
ci-queue requires several custom minitest reporters.
Please do not overwrite them.
If you have a statement in your test suite like this
Minitest::Reporters.use!(SomeReporter.new)
you should only run it when other reporters have not been configured
to avoid breaking ci-queue's functionality and getting false test summaries.
Use something like this:
if Minitest::Reporters.reporters.nil?
Minitest::Reporters.use!(SomeReporter.new)
end
WARNING
end

def release_command
require_worker_id!
queue.release!
Expand Down

0 comments on commit dd2388f

Please sign in to comment.