Class: Minitest::Distributed::Reporters::DistributedPogressReporter
- Inherits:
-
Reporter
- Object
- Reporter
- Minitest::Distributed::Reporters::DistributedPogressReporter
- Extended by:
- T::Sig
- Defined in:
- lib/minitest/distributed/reporters/distributed_progress_reporter.rb
Instance Attribute Summary collapse
-
#coordinator ⇒ Object
readonly
Returns the value of attribute coordinator.
Instance Method Summary collapse
-
#initialize(io, options) ⇒ DistributedPogressReporter
constructor
A new instance of DistributedPogressReporter.
- #prerecord(klass, name) ⇒ Object
- #record(result) ⇒ Object
- #report ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(io, options) ⇒ DistributedPogressReporter
Returns a new instance of DistributedPogressReporter.
16 17 18 19 20 21 22 23 24 |
# File 'lib/minitest/distributed/reporters/distributed_progress_reporter.rb', line 16 def initialize(io, ) super if io.tty? io.sync = true end @coordinator = T.let([:distributed].coordinator, Coordinators::CoordinatorInterface) @window_line_width = T.let(nil, T.nilable(Integer)) @show_progress = T.let([:distributed].progress, T::Boolean) end |
Instance Attribute Details
#coordinator ⇒ Object (readonly)
Returns the value of attribute coordinator.
13 14 15 |
# File 'lib/minitest/distributed/reporters/distributed_progress_reporter.rb', line 13 def coordinator @coordinator end |
Instance Method Details
#prerecord(klass, name) ⇒ Object
40 41 42 43 44 45 |
# 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) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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 [:verbose] when ResultType::Error, ResultType::Failed, ResultType::Requeued io.puts("#{result}\n") else T.absurd(result_type) end end |
#report ⇒ Object
64 65 66 |
# File 'lib/minitest/distributed/reporters/distributed_progress_reporter.rb', line 64 def report clear_current_line if show_progress? end |
#start ⇒ Object
27 28 29 30 |
# File 'lib/minitest/distributed/reporters/distributed_progress_reporter.rb', line 27 def start Signal.trap("WINCH") { @window_line_width = nil } super end |