Module: Bulldogger::Minitest

Defined in:
lib/bulldogger/integrations/minitest.rb

Overview

Connects Minitest failures to evidence and replay paths. It does not change test isolation, exception handling, or test results.

Defined Under Namespace

Classes: Reporter

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.instanceObject

Dogfood assigns an outer observer that the suite's default reset cannot reach. Normal users keep the default instance without extra setup.



16
17
18
# File 'lib/bulldogger/integrations/minitest.rb', line 16

def instance
  @instance || Bulldogger.default
end

Class Method Details

.minitest_plugin_init(_options) ⇒ Object

Minitest's own extension point: Minitest.register_plugin with a Module makes Minitest call #minitest_plugin_init once, during Minitest.run, at the one moment Minitest.reporter is set (the accessor is nil outside that window). That is why Bulldogger.start and the reporter wiring happen here and not at require time -- nothing has run yet, so nothing needs the TracePoint before this.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bulldogger/integrations/minitest.rb', line 27

def self.minitest_plugin_init(_options)
  return if @wired

  @wired = true
  # The child records full execution. A second failure observer could start
  # nested replay and could change the isolated test result.
  return if ENV["BULLDOGGER_REPLAY_CHILD"] == "1"

  instance.start
  ::Minitest.reporter << Reporter.new
  ::Minitest.after_run do
    instance.finish
    instance.stop
  end
end