minitest-heat 0.0.3 → 0.0.4
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/Gemfile.lock +1 -1
- data/lib/minitest/heat/issue.rb +26 -10
- data/lib/minitest/heat/location.rb +1 -1
- data/lib/minitest/heat/map.rb +7 -6
- data/lib/minitest/heat/output.rb +3 -5
- data/lib/minitest/heat/results.rb +5 -11
- data/lib/minitest/heat/version.rb +1 -1
- data/lib/minitest/heat_reporter.rb +7 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbfeed7b313b60332751ad13c01750b56452e6cac80f98346d4f7233ae807cef
|
4
|
+
data.tar.gz: 7a734d467343b7da882c8a5f62e1005664ea9b2ab889d766416d8f21fce2299b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '07468b2090eef7a6475382db46e9bc150d2fc30e54d54d6744c0c12d6c33364f6d39aff6938baf4647c0e64fe7c754d0c1ad8b42aebf7b87e8edce8a1c35542f'
|
7
|
+
data.tar.gz: f1f961dc9bcf258d09fec7184dc0cb778d5b9fbc865ad2ed2c9d2f68628c4329990febc45b41770582826ab26576236c41657ced44c0ddb494b1b7fb71403c38
|
data/Gemfile.lock
CHANGED
data/lib/minitest/heat/issue.rb
CHANGED
@@ -8,7 +8,20 @@ module Minitest
|
|
8
8
|
class Issue
|
9
9
|
extend Forwardable
|
10
10
|
|
11
|
-
|
11
|
+
SLOW_THRESHOLDS = {
|
12
|
+
slow: 1.0,
|
13
|
+
painful: 3.0
|
14
|
+
}
|
15
|
+
|
16
|
+
MARKERS = {
|
17
|
+
success: '·',
|
18
|
+
slow: '–',
|
19
|
+
painful: '—',
|
20
|
+
broken: 'B',
|
21
|
+
error: 'E',
|
22
|
+
skipped: 'S',
|
23
|
+
failure: 'F',
|
24
|
+
}
|
12
25
|
|
13
26
|
SHARED_SYMBOLS = {
|
14
27
|
spacer: ' · ',
|
@@ -52,6 +65,8 @@ module Minitest
|
|
52
65
|
:skipped
|
53
66
|
elsif !passed?
|
54
67
|
:failure
|
68
|
+
elsif painful?
|
69
|
+
:painful
|
55
70
|
elsif slow?
|
56
71
|
:slow
|
57
72
|
else
|
@@ -59,8 +74,16 @@ module Minitest
|
|
59
74
|
end
|
60
75
|
end
|
61
76
|
|
77
|
+
def hit?
|
78
|
+
!passed? || slow?
|
79
|
+
end
|
80
|
+
|
62
81
|
def slow?
|
63
|
-
time
|
82
|
+
time >= SLOW_THRESHOLDS[:slow]
|
83
|
+
end
|
84
|
+
|
85
|
+
def painful?
|
86
|
+
time >= SLOW_THRESHOLDS[:painful]
|
64
87
|
end
|
65
88
|
|
66
89
|
def in_test?
|
@@ -111,14 +134,7 @@ module Minitest
|
|
111
134
|
end
|
112
135
|
|
113
136
|
def marker
|
114
|
-
|
115
|
-
when :broken then 'B'
|
116
|
-
when :error then 'E'
|
117
|
-
when :skipped then 'S'
|
118
|
-
when :failure then 'F'
|
119
|
-
when :slow then '_'
|
120
|
-
else '.'
|
121
|
-
end
|
137
|
+
MARKERS.fetch(type.to_sym)
|
122
138
|
end
|
123
139
|
|
124
140
|
def summary
|
@@ -37,7 +37,7 @@ module Minitest
|
|
37
37
|
def source_file
|
38
38
|
return test_file if backtrace.empty?
|
39
39
|
|
40
|
-
source_line = backtrace.final_project_location
|
40
|
+
source_line = backtrace.final_project_location || backtrace.final_location
|
41
41
|
|
42
42
|
reduced_path("#{source_line.path}/#{source_line.file}")
|
43
43
|
end
|
data/lib/minitest/heat/map.rb
CHANGED
@@ -13,11 +13,12 @@ module Minitest
|
|
13
13
|
# test is broken (i.e. raising an exception), that's a special sort of failure that would be
|
14
14
|
# misleading. It doesn't represent a proper failure, but rather a test that doesn't work.
|
15
15
|
WEIGHTS = {
|
16
|
-
error: 3,
|
17
|
-
broken: 1,
|
18
|
-
failure: 1,
|
19
|
-
skipped: 0,
|
20
|
-
|
16
|
+
error: 3, # exceptions from source code have the highest liklihood of a ripple effect
|
17
|
+
broken: 1, # broken tests won't have ripple effects but can't help if they can't run
|
18
|
+
failure: 1, # failures are kind of the whole point, and they could have ripple effects
|
19
|
+
skipped: 0, # skips aren't failures, but they shouldn't go ignored
|
20
|
+
painful: 0, # slow tests aren't failures, but they shouldn't be ignored
|
21
|
+
slow: 0,
|
21
22
|
}
|
22
23
|
|
23
24
|
def initialize
|
@@ -46,7 +47,7 @@ module Minitest
|
|
46
47
|
files = {}
|
47
48
|
@hits.each_pair do |filename, details|
|
48
49
|
# Can't really be a "hot spot" with just a single issue
|
49
|
-
next unless details[:
|
50
|
+
next unless details[:weight] > 1
|
50
51
|
|
51
52
|
files[filename] = details[:weight]
|
52
53
|
end
|
data/lib/minitest/heat/output.rb
CHANGED
@@ -58,13 +58,12 @@ module Minitest
|
|
58
58
|
|
59
59
|
def style_components
|
60
60
|
{
|
61
|
-
success_bold: %i[bold green],
|
62
61
|
success: %i[default green],
|
63
|
-
slow: %i[
|
62
|
+
slow: %i[bold green],
|
64
63
|
error: %i[bold red],
|
65
64
|
broken: %i[bold red],
|
66
65
|
failure: %i[default red],
|
67
|
-
skipped: %i[
|
66
|
+
skipped: %i[default yellow],
|
68
67
|
warning_light: %i[light yellow],
|
69
68
|
source: %i[italic default],
|
70
69
|
bold: %i[bold default],
|
@@ -127,7 +126,6 @@ module Minitest
|
|
127
126
|
when 'B' then text(:failure, value)
|
128
127
|
when 'F' then text(:failure, value)
|
129
128
|
when 'S' then text(:skipped, value)
|
130
|
-
when '_' then text(:success, value)
|
131
129
|
else text(:success, value)
|
132
130
|
end
|
133
131
|
end
|
@@ -165,7 +163,7 @@ module Minitest
|
|
165
163
|
text(:broken, 'B' * values[:broken].size) if values[:broken]&.any?
|
166
164
|
text(:failure, 'F' * values[:failure].size) if values[:failure]&.any?
|
167
165
|
text(:skipped, 'S' * values[:skipped].size) if values[:skipped]&.any?
|
168
|
-
text(:muted, ' ')
|
166
|
+
text(:muted, ' ') if values[:error]&.any? || values[:broken]&.any? || values[:failure]&.any? || values[:skipped]&.any?
|
169
167
|
|
170
168
|
text(:muted, "#{path.delete_prefix('/')}")
|
171
169
|
text(:default, "#{filename}")
|
@@ -49,8 +49,8 @@ module Minitest
|
|
49
49
|
(assertion_count / total_time).round(2)
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
errors? || failures? || skips?
|
52
|
+
def problems?
|
53
|
+
errors? || brokens? || failures? || skips?
|
54
54
|
end
|
55
55
|
|
56
56
|
def errors
|
@@ -93,19 +93,13 @@ module Minitest
|
|
93
93
|
skips.any?
|
94
94
|
end
|
95
95
|
|
96
|
-
def
|
96
|
+
def record(issue)
|
97
97
|
@test_count += 1
|
98
|
-
@assertion_count += result.assertions
|
99
|
-
@success_count += 1 if result.passed?
|
100
|
-
end
|
101
|
-
|
102
|
-
def record_issue(result)
|
103
|
-
issue = Heat::Issue.new(result)
|
98
|
+
@assertion_count += issue.result.assertions
|
99
|
+
@success_count += 1 if issue.result.passed?
|
104
100
|
|
105
101
|
@issues[issue.type] ||= []
|
106
102
|
@issues[issue.type] << issue
|
107
|
-
|
108
|
-
issue
|
109
103
|
end
|
110
104
|
end
|
111
105
|
end
|
@@ -59,14 +59,13 @@ module Minitest
|
|
59
59
|
# Minitest::Result source:
|
60
60
|
# https://github.com/seattlerb/minitest/blob/f4f57afaeb3a11bd0b86ab0757704cb78db96cf4/lib/minitest.rb#L504
|
61
61
|
def record(result)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
62
|
+
issue = Heat::Issue.new(result)
|
63
|
+
|
64
|
+
@results.record(issue)
|
65
|
+
|
66
|
+
@map.add(*issue.to_hit) if issue.hit?
|
67
|
+
|
68
|
+
output.marker(issue.marker)
|
70
69
|
end
|
71
70
|
|
72
71
|
# Outputs the summary of the run.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minitest-heat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett Dimon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|