Class: Bulldogger::Minitest::Reporter

Inherits:
Minitest::AbstractReporter
  • Object
show all
Defined in:
lib/bulldogger/integrations/minitest.rb

Overview

Turns one finished test into a Bulldogger evidence file. Registered into Minitest's CompositeReporter, so #record runs once per test method, pass or fail. Minitest.run_one_method always returns a Minitest::Result, never the Test instance itself, so the test's id/file/line come from Result's own klass/name/source_location rather than from re-deriving them.

Instance Method Summary collapse

Instance Method Details

#record(result) ⇒ Object



50
51
52
53
54
55
56
57
58
59
# File 'lib/bulldogger/integrations/minitest.rb', line 50

def record(result)
  return if ENV["BULLDOGGER_REPLAY_CHILD"] == "1"

  failure = result.failure
  return if failure.nil? || result.skipped?

  exception = exception_for(failure)
  path = Minitest.instance.record_failure(exception: exception, test: test_for(result))
  annotate!(failure, path) if path
end