class Minitest::Distributed::Reporters::DistributedPogressReporter
Attributes
coordinator[R]
Public Class Methods
new(io, options)
click to toggle source
Calls superclass method
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 16 def initialize(io, options) super if io.tty? io.sync = true end @coordinator = T.let(options[:distributed].coordinator, Coordinators::CoordinatorInterface) @window_line_width = T.let(nil, T.nilable(Integer)) @show_progress = T.let(options[:distributed].progress, T::Boolean) end
Public Instance Methods
prerecord(klass, name)
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 40 def prerecord(klass, name) if show_progress? clear_current_line io.print("[#{results.acks}/#{results.size}] #{klass}##{name}".slice(0...window_line_width)) end end
record(result)
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 48 def record(result) clear_current_line if show_progress? case (result_type = ResultType.of(result)) when ResultType::Passed # TODO: warn for tests that are slower than the test timeout. when ResultType::Skipped, ResultType::Discarded io.puts("#{result}\n") if options[:verbose] when ResultType::Error, ResultType::Failed, ResultType::Requeued io.puts("#{result}\n") else T.absurd(result_type) end end
report()
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 64 def report clear_current_line if show_progress? end
start()
click to toggle source
Calls superclass method
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 27 def start Signal.trap("WINCH") { @window_line_width = nil } super end
Private Instance Methods
clear_current_line()
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 76 def clear_current_line io.print("\r" + (" " * window_line_width) + "\r") end
results()
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 91 def results coordinator.combined_results end
show_progress?()
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 71 def show_progress? @show_progress end
window_line_width()
click to toggle source
# File lib/minitest/distributed/reporters/distributed_progress_reporter.rb, line 81 def window_line_width @window_line_width ||= begin _height, width = io.winsize width > 0 ? width : 80 rescue Errno::ENOTTY 80 end end