Class: Minitest::Heat::Output
- Inherits:
-
Object
- Object
- Minitest::Heat::Output
show all
- Defined in:
- lib/minitest/heat/output.rb,
lib/minitest/heat/output/map.rb,
lib/minitest/heat/output/issue.rb,
lib/minitest/heat/output/token.rb,
lib/minitest/heat/output/marker.rb,
lib/minitest/heat/output/results.rb,
lib/minitest/heat/output/backtrace.rb,
lib/minitest/heat/output/source_code.rb
Overview
Friendly API for printing nicely-formatted output to the console
Defined Under Namespace
Classes: Backtrace, Issue, Map, Marker, Results, SourceCode, Token
Constant Summary
collapse
- SYMBOLS =
rubocop:disable Metrics/ClassLength
{
middot: '·',
arrow: '➜',
lead: '|'
}.freeze
- TOKENS =
{
spacer: [:muted, " #{SYMBOLS[:middot]} "],
muted_arrow: [:muted, " #{SYMBOLS[:arrow]} "],
muted_lead: [:muted, "#{SYMBOLS[:lead]} "]
}.freeze
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(stream = $stdout) ⇒ Output
Returns a new instance of Output.
29
30
31
32
33
34
|
# File 'lib/minitest/heat/output.rb', line 29
def initialize(stream = $stdout)
@stream = stream.tap do |str|
str.sync = str.respond_to?(:sync=)
end
end
|
Instance Attribute Details
#stream ⇒ Object
Returns the value of attribute stream.
27
28
29
|
# File 'lib/minitest/heat/output.rb', line 27
def stream
@stream
end
|
Instance Method Details
#compact_summary(results, timer) ⇒ Object
82
83
84
85
86
87
88
|
# File 'lib/minitest/heat/output.rb', line 82
def compact_summary(results, timer)
newline
print_tokens ::Minitest::Heat::Output::Results.new(results, timer).tokens
rescue StandardError => e
message = "Sorry, but Minitest Heat couldn't display the summary."
exception_guidance(message, e)
end
|
#heat_map(map) ⇒ Object
90
91
92
93
94
95
96
97
|
# File 'lib/minitest/heat/output.rb', line 90
def heat_map(map)
newline
print_tokens ::Minitest::Heat::Output::Map.new(map).tokens
newline
rescue StandardError => e
message = "Sorry, but Minitest Heat couldn't display the heat map."
exception_guidance(message, e)
end
|
#issue_details(issue) ⇒ Object
71
72
73
74
75
76
|
# File 'lib/minitest/heat/output.rb', line 71
def issue_details(issue)
print_tokens Minitest::Heat::Output::Issue.new(issue).tokens
rescue StandardError => e
message = "Sorry, but Minitest Heat couldn't display output for a specific failure."
exception_guidance(message, e)
end
|
#issues_list(results) ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/minitest/heat/output.rb', line 45
def issues_list(results)
newline
newline
%i[slows painfuls skips failures brokens errors].each do |issue_category|
next unless show?(issue_category, results)
issues = results.send(issue_category)
issues
.sort_by { |issue| issue.locations.most_relevant.to_a }
.each { |issue| issue_details(issue) }
end
rescue StandardError => e
message = "Sorry, but Minitest Heat couldn't display the details of any failures."
exception_guidance(message, e)
end
|
#marker(issue_type) ⇒ Object
#print(*args) ⇒ Object
36
37
38
|
# File 'lib/minitest/heat/output.rb', line 36
def print(*args)
stream.print(*args)
end
|
#puts(*args) ⇒ Object
Also known as:
newline
40
41
42
|
# File 'lib/minitest/heat/output.rb', line 40
def puts(*args)
stream.puts(*args)
end
|