minitest-heat 0.0.9 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/Gemfile.lock +6 -6
- data/README.md +49 -14
- data/examples/exceptions.png +0 -0
- data/examples/failures.png +0 -0
- data/examples/map.png +0 -0
- data/examples/markers.png +0 -0
- data/examples/skips.png +0 -0
- data/examples/slows.png +0 -0
- data/lib/minitest/heat/backtrace/line_parser.rb +25 -0
- data/lib/minitest/heat/backtrace.rb +39 -43
- data/lib/minitest/heat/hit.rb +36 -19
- data/lib/minitest/heat/issue.rb +118 -81
- data/lib/minitest/heat/location.rb +115 -116
- data/lib/minitest/heat/locations.rb +105 -0
- data/lib/minitest/heat/map.rb +16 -4
- data/lib/minitest/heat/output/backtrace.rb +90 -67
- data/lib/minitest/heat/output/issue.rb +76 -67
- data/lib/minitest/heat/output/map.rb +127 -25
- data/lib/minitest/heat/output/marker.rb +5 -3
- data/lib/minitest/heat/output/results.rb +3 -2
- data/lib/minitest/heat/output/source_code.rb +1 -1
- data/lib/minitest/heat/output/token.rb +2 -1
- data/lib/minitest/heat/output.rb +76 -6
- data/lib/minitest/heat/results.rb +23 -3
- data/lib/minitest/heat/source.rb +1 -1
- data/lib/minitest/heat/version.rb +1 -1
- data/lib/minitest/heat.rb +3 -2
- data/lib/minitest/heat_plugin.rb +9 -17
- data/lib/minitest/heat_reporter.rb +25 -35
- metadata +11 -4
- data/lib/minitest/heat/line.rb +0 -74
data/lib/minitest/heat/line.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'forwardable'
|
4
|
-
|
5
|
-
module Minitest
|
6
|
-
module Heat
|
7
|
-
# Represents a line of code from the project and provides convenient access to information about
|
8
|
-
# the line for displaying in test results
|
9
|
-
class Line
|
10
|
-
attr_accessor :pathname, :number, :container
|
11
|
-
alias line_number number
|
12
|
-
|
13
|
-
def initialize(pathname:, number:, container: nil)
|
14
|
-
@pathname = Pathname(pathname)
|
15
|
-
@number = number.to_i
|
16
|
-
@container = container.to_s
|
17
|
-
end
|
18
|
-
|
19
|
-
# Convenient interface to read a line from a backtrace convert it to usable components
|
20
|
-
def self.parse_backtrace(raw_text)
|
21
|
-
raw_pathname, raw_line_number, raw_container = raw_text.split(':')
|
22
|
-
raw_container = raw_container.delete_prefix('in `').delete_suffix("'")
|
23
|
-
|
24
|
-
new(pathname: raw_pathname, number: raw_line_number, container: raw_container)
|
25
|
-
end
|
26
|
-
|
27
|
-
def to_s
|
28
|
-
"#{location} in `#{container}`"
|
29
|
-
end
|
30
|
-
|
31
|
-
def path
|
32
|
-
pathname.exist? ? pathname.dirname : UNRECOGNIZED
|
33
|
-
end
|
34
|
-
|
35
|
-
def file
|
36
|
-
pathname.exist? ? pathname.basename : UNRECOGNIZED
|
37
|
-
end
|
38
|
-
|
39
|
-
def mtime
|
40
|
-
pathname.exist? ? pathname.mtime : UNKNOWN_MODIFICATION_TIME
|
41
|
-
end
|
42
|
-
|
43
|
-
def age_in_seconds
|
44
|
-
pathname.exist? ? seconds_ago : UNKNOWN_MODIFICATION_SECONDS
|
45
|
-
end
|
46
|
-
|
47
|
-
def location
|
48
|
-
"#{pathname}:#{number}"
|
49
|
-
end
|
50
|
-
|
51
|
-
def short_location
|
52
|
-
"#{file}:#{number}"
|
53
|
-
end
|
54
|
-
|
55
|
-
def source_code(max_line_count: 1)
|
56
|
-
Minitest::Heat::Source.new(
|
57
|
-
pathname.to_s,
|
58
|
-
line_number: line_number,
|
59
|
-
max_line_count: max_line_count
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
UNRECOGNIZED = '(Unrecognized File)'
|
66
|
-
UNKNOWN_MODIFICATION_TIME = Time.at(0)
|
67
|
-
UNKNOWN_MODIFICATION_SECONDS = -1
|
68
|
-
|
69
|
-
def seconds_ago
|
70
|
-
(Time.now - mtime).to_i
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|