Module: Bulldogger::FailureOutput

Defined in:
lib/bulldogger/failure_output.rb

Overview

Formats the file guidance that the recorded evidence state supports. Integrations own framework output; this module only formats two stable lines.

Class Method Summary collapse

Class Method Details

.lines(path) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bulldogger/failure_output.rb', line 12

def lines(path)
  evidence = JSON.parse(File.read(path))

  lines = if evidence["capture_mode"] == "missed"
    ["bulldogger evidence: #{path} (snapshot holds no frames)"]
  elsif ApplicationFrames.available?(evidence.dig("test", "file"), evidence.fetch("frames", []))
    ["bulldogger evidence: #{path} (raising method is in these frames)"]
  else
    [missing_origin_line(path)]
  end
  lines << "bulldogger rerun: #{evidence['rerun_command']}" if evidence["rerun_command"]
  lines
rescue JSON::ParserError, SystemCallError
  ["bulldogger evidence: #{path}"]
end

.missing_origin_line(path) ⇒ Object



28
29
30
# File 'lib/bulldogger/failure_output.rb', line 28

def missing_origin_line(path)
  "bulldogger evidence: #{path} (frames do not show where the value came from)"
end