Class: Minitest::Heat::Results
- Inherits:
-
Object
- Object
- Minitest::Heat::Results
- Defined in:
- lib/minitest/heat/results.rb
Overview
A collection of test failures
Instance Attribute Summary collapse
-
#heat_map ⇒ Object
readonly
Returns the value of attribute heat_map.
-
#issues ⇒ Object
readonly
Returns the value of attribute issues.
Instance Method Summary collapse
- #brokens ⇒ Object
- #errors ⇒ Object
- #failures ⇒ Object
-
#initialize ⇒ Results
constructor
A new instance of Results.
- #painfuls ⇒ Object
- #problems? ⇒ Boolean
-
#record(issue) ⇒ type
Logs an issue to the results for later reporting.
- #skips ⇒ Object
- #slows ⇒ Object
- #update_heat_map(issue) ⇒ Object
Constructor Details
Instance Attribute Details
#heat_map ⇒ Object (readonly)
Returns the value of attribute heat_map.
7 8 9 |
# File 'lib/minitest/heat/results.rb', line 7 def heat_map @heat_map end |
#issues ⇒ Object (readonly)
Returns the value of attribute issues.
7 8 9 |
# File 'lib/minitest/heat/results.rb', line 7 def issues @issues end |
Instance Method Details
#brokens ⇒ Object
59 60 61 |
# File 'lib/minitest/heat/results.rb', line 59 def brokens @brokens ||= select_issues(:broken) end |
#errors ⇒ Object
55 56 57 |
# File 'lib/minitest/heat/results.rb', line 55 def errors @errors ||= select_issues(:error) end |
#failures ⇒ Object
63 64 65 |
# File 'lib/minitest/heat/results.rb', line 63 def failures @failures ||= select_issues(:failure) end |
#painfuls ⇒ Object
71 72 73 |
# File 'lib/minitest/heat/results.rb', line 71 def painfuls @painfuls ||= select_issues(:painful).sort_by(&:execution_time).reverse end |
#problems? ⇒ Boolean
51 52 53 |
# File 'lib/minitest/heat/results.rb', line 51 def problems? errors.any? || brokens.any? || failures.any? end |
#record(issue) ⇒ type
Logs an issue to the results for later reporting
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/minitest/heat/results.rb', line 18 def record(issue) # Record everything—even if it's a success @issues.push(issue) # If it's not a genuine problem, we're done here... return unless issue.hit? # ...otherwise update the heat map update_heat_map(issue) end |
#skips ⇒ Object
67 68 69 |
# File 'lib/minitest/heat/results.rb', line 67 def skips @skips ||= select_issues(:skipped) end |
#slows ⇒ Object
75 76 77 |
# File 'lib/minitest/heat/results.rb', line 75 def slows @slows ||= select_issues(:slow).sort_by(&:execution_time).reverse end |
#update_heat_map(issue) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/minitest/heat/results.rb', line 29 def update_heat_map(issue) # For heat map purposes, only the project backtrace lines are interesting pathname, line_number = issue.locations.project.to_a # A backtrace is only relevant for exception-generating issues (i.e. errors), not slows or skips # However, while assertion failures won't have a backtrace, there can still be repeated line # numbers if the tests reference a shared method with an assertion in it. So in those cases, # the backtrace is simply the test definition backtrace = if issue.error? # With errors, we have a backtrace issue.locations.backtrace.project_locations else # With failures, the test definition is the most granular backtrace equivalent location = issue.locations.test_definition location.raw_container = issue.test_identifier [location] end @heat_map.add(pathname, line_number, issue.type, backtrace: backtrace) end |