minitest-heat 0.0.5 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +23 -0
- data/Gemfile +5 -3
- data/Gemfile.lock +30 -1
- data/README.md +12 -3
- data/Rakefile +8 -6
- data/lib/minitest/heat/backtrace.rb +19 -74
- data/lib/minitest/heat/hit.rb +79 -0
- data/lib/minitest/heat/issue.rb +49 -34
- data/lib/minitest/heat/line.rb +74 -0
- data/lib/minitest/heat/location.rb +20 -14
- data/lib/minitest/heat/map.rb +7 -34
- data/lib/minitest/heat/output/backtrace.rb +32 -32
- data/lib/minitest/heat/output/issue.rb +144 -0
- data/lib/minitest/heat/output/map.rb +59 -3
- data/lib/minitest/heat/output/marker.rb +50 -0
- data/lib/minitest/heat/output/results.rb +44 -22
- data/lib/minitest/heat/output/source_code.rb +2 -2
- data/lib/minitest/heat/output/token.rb +15 -13
- data/lib/minitest/heat/output.rb +23 -120
- data/lib/minitest/heat/results.rb +19 -75
- data/lib/minitest/heat/timer.rb +81 -0
- data/lib/minitest/heat/version.rb +3 -1
- data/lib/minitest/heat.rb +3 -0
- data/lib/minitest/heat_plugin.rb +5 -5
- data/lib/minitest/heat_reporter.rb +50 -26
- data/minitest-heat.gemspec +4 -2
- metadata +64 -4
- data/lib/minitest/heat/output/location.rb +0 -20
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'heat'
|
4
4
|
|
5
5
|
module Minitest
|
6
6
|
# Custom minitest reporter to proactively identify likely culprits in test failures by focusing on
|
@@ -29,48 +29,52 @@ module Minitest
|
|
29
29
|
# Pulls from minitest-color as well:
|
30
30
|
# https://github.com/teoljungberg/minitest-color/blob/master/lib/minitest/color_plugin.rb
|
31
31
|
class HeatReporter < AbstractReporter
|
32
|
-
|
33
32
|
attr_reader :output,
|
34
33
|
:options,
|
35
|
-
:
|
36
|
-
:
|
34
|
+
:timer,
|
35
|
+
:results
|
37
36
|
|
38
37
|
def initialize(io = $stdout, options = {})
|
39
|
-
@output = Heat::Output.new(io)
|
40
38
|
@options = options
|
41
39
|
|
42
|
-
@
|
43
|
-
@
|
40
|
+
@timer = Heat::Timer.new
|
41
|
+
@results = Heat::Results.new
|
42
|
+
@output = Heat::Output.new(io)
|
44
43
|
end
|
45
44
|
|
46
45
|
# Starts reporting on the run.
|
47
46
|
def start
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
timer.start!
|
48
|
+
|
49
|
+
# A couple of blank lines to create some breathing room
|
50
|
+
output.newline
|
51
|
+
output.newline
|
51
52
|
end
|
52
53
|
|
53
54
|
# About to start running a test. This allows a reporter to show that it is starting or that we
|
54
55
|
# are in the middle of a test run.
|
55
|
-
def prerecord(klass, name)
|
56
|
-
end
|
56
|
+
def prerecord(klass, name); end
|
57
57
|
|
58
58
|
# Records the data from a result.
|
59
|
+
#
|
59
60
|
# Minitest::Result source:
|
60
61
|
# https://github.com/seattlerb/minitest/blob/f4f57afaeb3a11bd0b86ab0757704cb78db96cf4/lib/minitest.rb#L504
|
61
62
|
def record(result)
|
63
|
+
# Convert a Minitest Result into an "issue" to more consistently expose the data needed to
|
64
|
+
# adjust the failure output to the type of failure
|
62
65
|
issue = Heat::Issue.new(result)
|
63
66
|
|
64
|
-
|
65
|
-
|
67
|
+
timer.increment_counts(issue.result.assertions)
|
68
|
+
results.record(issue)
|
66
69
|
|
67
|
-
output.marker(issue.
|
70
|
+
output.marker(issue.type)
|
68
71
|
end
|
69
72
|
|
70
73
|
# Outputs the summary of the run.
|
71
74
|
def report
|
72
|
-
|
75
|
+
timer.stop!
|
73
76
|
|
77
|
+
# A couple of blank lines to create some breathing room
|
74
78
|
output.newline
|
75
79
|
output.newline
|
76
80
|
|
@@ -78,25 +82,45 @@ module Minitest
|
|
78
82
|
# pressing issues are displayed at the bottom of the report in order to reduce scrolling.
|
79
83
|
# This way, as you fix issues, the list gets shorter, and eventually the least critical
|
80
84
|
# issues will be displayed without scrolling once more problematic issues are resolved.
|
81
|
-
|
82
|
-
|
83
|
-
end
|
85
|
+
%i[slows painfuls skips failures brokens errors].each do |issue_category|
|
86
|
+
next unless show?(issue_category)
|
84
87
|
|
85
|
-
|
86
|
-
results.skips.each { |issue| output.issue_details(issue) }
|
88
|
+
results.send(issue_category).each { |issue| output.issue_details(issue) }
|
87
89
|
end
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
91
|
+
# Display a short summary of the total issue counts fore ach category as well as performance
|
92
|
+
# details for the test suite as a whole
|
93
|
+
output.compact_summary(results, timer)
|
92
94
|
|
93
|
-
|
94
|
-
|
95
|
+
# If there were issues, shows a short heat map summary of which files and lines were the most
|
96
|
+
# common sources of issues
|
97
|
+
output.heat_map(results)
|
98
|
+
|
99
|
+
# A blank line to create some breathing room
|
100
|
+
output.newline
|
95
101
|
end
|
96
102
|
|
97
103
|
# Did this run pass?
|
98
104
|
def passed?
|
99
105
|
results.errors.empty? && results.failures.empty?
|
100
106
|
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def no_problems?
|
111
|
+
!results.problems?
|
112
|
+
end
|
113
|
+
|
114
|
+
def no_problems_or_skips?
|
115
|
+
!results.problems? && !results.skips.any?
|
116
|
+
end
|
117
|
+
|
118
|
+
def show?(issue_category)
|
119
|
+
case issue_category
|
120
|
+
when :skips then no_problems?
|
121
|
+
when :painfuls, :slows then no_problems_or_skips?
|
122
|
+
else true
|
123
|
+
end
|
124
|
+
end
|
101
125
|
end
|
102
126
|
end
|
data/minitest-heat.gemspec
CHANGED
@@ -21,8 +21,6 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.metadata['source_code_uri'] = 'https://github.com/garrettdimon/minitest-heat'
|
22
22
|
spec.metadata['wiki_uri'] = 'https://github.com/garrettdimon/minitest-heat/wiki'
|
23
23
|
|
24
|
-
|
25
|
-
|
26
24
|
# Specify which files should be added to the gem when it is released.
|
27
25
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
28
26
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
@@ -34,7 +32,11 @@ Gem::Specification.new do |spec|
|
|
34
32
|
|
35
33
|
spec.add_runtime_dependency 'minitest'
|
36
34
|
|
35
|
+
spec.add_development_dependency 'awesome_print'
|
37
36
|
spec.add_development_dependency 'dead_end'
|
38
37
|
spec.add_development_dependency 'pry'
|
38
|
+
spec.add_development_dependency 'rubocop'
|
39
|
+
spec.add_development_dependency 'rubocop-minitest'
|
40
|
+
spec.add_development_dependency 'rubocop-rake'
|
39
41
|
spec.add_development_dependency 'simplecov'
|
40
42
|
end
|
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.9
|
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-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: awesome_print
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: dead_end
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,6 +66,48 @@ dependencies:
|
|
52
66
|
- - ">="
|
53
67
|
- !ruby/object:Gem::Version
|
54
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
55
111
|
- !ruby/object:Gem::Dependency
|
56
112
|
name: simplecov
|
57
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +131,7 @@ extensions: []
|
|
75
131
|
extra_rdoc_files: []
|
76
132
|
files:
|
77
133
|
- ".gitignore"
|
134
|
+
- ".rubocop.yml"
|
78
135
|
- ".travis.yml"
|
79
136
|
- CODE_OF_CONDUCT.md
|
80
137
|
- Gemfile
|
@@ -86,19 +143,22 @@ files:
|
|
86
143
|
- bin/setup
|
87
144
|
- lib/minitest/heat.rb
|
88
145
|
- lib/minitest/heat/backtrace.rb
|
146
|
+
- lib/minitest/heat/hit.rb
|
89
147
|
- lib/minitest/heat/issue.rb
|
148
|
+
- lib/minitest/heat/line.rb
|
90
149
|
- lib/minitest/heat/location.rb
|
91
150
|
- lib/minitest/heat/map.rb
|
92
151
|
- lib/minitest/heat/output.rb
|
93
152
|
- lib/minitest/heat/output/backtrace.rb
|
94
153
|
- lib/minitest/heat/output/issue.rb
|
95
|
-
- lib/minitest/heat/output/location.rb
|
96
154
|
- lib/minitest/heat/output/map.rb
|
155
|
+
- lib/minitest/heat/output/marker.rb
|
97
156
|
- lib/minitest/heat/output/results.rb
|
98
157
|
- lib/minitest/heat/output/source_code.rb
|
99
158
|
- lib/minitest/heat/output/token.rb
|
100
159
|
- lib/minitest/heat/results.rb
|
101
160
|
- lib/minitest/heat/source.rb
|
161
|
+
- lib/minitest/heat/timer.rb
|
102
162
|
- lib/minitest/heat/version.rb
|
103
163
|
- lib/minitest/heat_plugin.rb
|
104
164
|
- lib/minitest/heat_reporter.rb
|
@@ -128,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
188
|
- !ruby/object:Gem::Version
|
129
189
|
version: '0'
|
130
190
|
requirements: []
|
131
|
-
rubygems_version: 3.1.
|
191
|
+
rubygems_version: 3.1.6
|
132
192
|
signing_key:
|
133
193
|
specification_version: 4
|
134
194
|
summary: Presents test results in a visual manner to guide you to where to look first.
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Minitest
|
4
|
-
module Heat
|
5
|
-
class Output
|
6
|
-
class Location
|
7
|
-
attr_accessor :location
|
8
|
-
|
9
|
-
def initialize(location)
|
10
|
-
@location = location
|
11
|
-
end
|
12
|
-
|
13
|
-
def tokens
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|