Class: Minitest::Distributed::Reporters::DistributedSummaryReporter

Inherits:
Reporter
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/minitest/distributed/reporters/distributed_summary_reporter.rb

Instance Method Summary collapse

Constructor Details

#initialize(io, options) ⇒ DistributedSummaryReporter

Returns a new instance of DistributedSummaryReporter.



11
12
13
14
15
# 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

Instance Method Details

#passed?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
53
54
# 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

#reportObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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

#startObject



18
19
20
21
# 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