class Minitest::Distributed::Reporters::DistributedSummaryReporter

Public Class Methods

new(io, options) click to toggle source
Calls superclass method
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 11
def initialize(io, options)
  super
  io.sync = true
  @start_time = T.let(0.0, Float)
end

Public Instance Methods

passed?() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 45
def passed?
  return false if configuration.coordinator.aborted?

  # Generally, we want the workers to fail that had at least one failed or errored
  # test. We have to trust that another worker will fail (and fail the build) if it
  # encountered a failed test. We trust that the other worker will do this correctly,
  # but we do verify that the statistics for the complete run are valid,
  # to have some protection against unknown edge cases and bugs.
  local_results.passed? && combined_results.valid?
end
report() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 24
def report
  print_discard_warning if local_results.discards > 0

  if configuration.coordinator.aborted?
    io.puts("Cannot retry a run that was cut short during the previous attempt.")
    io.puts
  elsif combined_results.abort?
    io.puts("The run was cut short after reaching the limit of #{configuration.max_failures} test failures.")
    io.puts
  end

  formatted_duration = format("(in %0.3fs)", Minitest.clock_time - @start_time)
  if combined_results == local_results
    io.puts("Results: #{combined_results} #{formatted_duration}")
  else
    io.puts("This worker:      #{local_results} #{formatted_duration}")
    io.puts("Combined results: #{combined_results}")
  end
end
start() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 18
def start
  @start_time = Minitest.clock_time
  io.puts("Run options: #{options[:args]}\n\n")
end

Protected Instance Methods

combined_results() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 75
def combined_results
  @combined_results = T.let(@combined_results, T.nilable(ResultAggregate))
  @combined_results ||= configuration.coordinator.combined_results
end
configuration() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 81
def configuration
  T.let(options[:distributed], Configuration)
end
local_results() click to toggle source
# File lib/minitest/distributed/reporters/distributed_summary_reporter.rb, line 69
def local_results
  @local_results = T.let(@local_results, T.nilable(ResultAggregate))
  @local_results ||= configuration.coordinator.local_results
end
print_discard_warning() click to toggle source