Class: Verity::Reporters::ParallelSummaryReporter
- Inherits:
-
Object
- Object
- Verity::Reporters::ParallelSummaryReporter
- Defined in:
- lib/verity/reporters/parallel_summary_reporter.rb
Overview
Internal: Shared helper that emits the multi-worker summary block. Typically called from a reporter’s on_parallel_complete to print aggregate counts and list any failures or errors from the manifest.
Instance Method Summary collapse
-
#emit(counts:, problem_rows:) ⇒ Object
Public: Write the parallel-run summary to the IO stream.
-
#initialize(io = $stdout) ⇒ ParallelSummaryReporter
constructor
A new instance of ParallelSummaryReporter.
Constructor Details
#initialize(io = $stdout) ⇒ ParallelSummaryReporter
Returns a new instance of ParallelSummaryReporter.
9 10 11 |
# File 'lib/verity/reporters/parallel_summary_reporter.rb', line 9 def initialize(io = $stdout) @io = io end |
Instance Method Details
#emit(counts:, problem_rows:) ⇒ Object
Public: Write the parallel-run summary to the IO stream.
counts - Hash with String status keys (“passed”, “failed”, etc.)
and Integer counts.
problem_rows - Array of Hashes with :fingerprint, :description, :status,
and :failure from Manifest#failures_for_report.
Returns nothing.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/verity/reporters/parallel_summary_reporter.rb', line 21 def emit(counts:, problem_rows:) passed = counts.fetch("passed", 0) failed = counts.fetch("failed", 0) errored = counts.fetch("errored", 0) pending = counts.fetch("pending", 0) running = counts.fetch("running", 0) skipped = counts.fetch("skipped", 0) total = passed + failed + errored + pending + running line = "Parallel run finished (#{total} tests in manifest: #{passed} passed, #{failed} failed, #{errored} errored, #{pending} pending, #{running} running" line += ", #{skipped} skipped" if skipped > 0 line += ")" @io.puts "\n#{line}" return if problem_rows.empty? @io.puts "\nFailures and errors:" problem_rows.each do |row| fp = row[:fingerprint] desc = row[:description] st = row[:status] @io.puts " #{st} #{desc} (#{fp})" next if row[:failure].nil? || row[:failure].empty? msg = row[:failure]["message"] || row[:failure][:message] @io.puts " #{msg}" if msg end end |