minitest-heat 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01c04bc05d2d9aa703e552fcb104c8e7124f78ced8b65cda3f40810818877108
4
- data.tar.gz: f9326507abcea6e99582a1ed4436b728efbab9f6121b254a17977f41db1f3152
3
+ metadata.gz: dc3d70999fca25317d7ff7a96b67cd2c6ee6f59970054b0eaec88c051581b855
4
+ data.tar.gz: 1197c05fe06b12737b2c73c27d7266e986fcae22cd3957b3e64cd14e2e70295f
5
5
  SHA512:
6
- metadata.gz: df96aed9406de7bbe7905c1e994f418dad556b06651b6bf173977a771ca03f29aad5a91696b6f27bbc1dfdc854e7fbd69636294187214df152ba68d902525f81
7
- data.tar.gz: 4d7fbe78fed79d9c2bda3be2ed6d1cc92d8b8758196cc940634aec9912db5e04156a6a50e4bdf69777176803b9ddab9a2838f84829758f6bc63b874ee01cfec6
6
+ metadata.gz: 207f670e0e27dedb872c8251e3890043955c60b6dd6e7dbafce1ba11fd9de5dde20ecf902ac0afd7fa5338d846afa9bc0c2f498df1ca5cdf83b964865792075f
7
+ data.tar.gz: c7d3219eb7c7d357a6bdeb82695356f2b56f1bc0f617ed9a9719c3c8227ca9b9bbf0c4929c14d75eed60ce6eade8552f693ad689d6b71c057fc08015a3d38828
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-heat (0.0.2)
4
+ minitest-heat (0.0.3)
5
5
  minitest
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  coderay (1.1.3)
11
+ dead_end (1.1.7)
11
12
  docile (1.4.0)
12
13
  method_source (1.0.0)
13
14
  minitest (5.14.4)
@@ -26,6 +27,7 @@ PLATFORMS
26
27
  ruby
27
28
 
28
29
  DEPENDENCIES
30
+ dead_end
29
31
  minitest (~> 5.0)
30
32
  minitest-heat!
31
33
  pry
@@ -100,7 +100,7 @@ module Minitest
100
100
  # When the exception came out of the test itself, that's a different kind of exception
101
101
  # that really only indicates there's a problem with the code in the test. It's kind of
102
102
  # between an error and a test.
103
- 'Broken Test'
103
+ 'Test Error'
104
104
  elsif error? || !passed?
105
105
  failure.result_label
106
106
  elsif slow?
@@ -116,7 +116,7 @@ module Minitest
116
116
  when :error then 'E'
117
117
  when :skipped then 'S'
118
118
  when :failure then 'F'
119
- when :slow then 'S'
119
+ when :slow then '_'
120
120
  else '.'
121
121
  end
122
122
  end
@@ -4,87 +4,96 @@ module Minitest
4
4
  module Heat
5
5
  # Friendly API for printing nicely-formatted output to the console
6
6
  class Output
7
- Token = Struct.new(:style, :content) do
8
- STYLES = {
9
- error: %i[bold red],
10
- broken: %i[bold red],
11
- failure: %i[default red],
12
- skipped: %i[bold yellow],
13
- success: %i[default green],
14
- slow: %i[bold green],
15
- source: %i[italic default],
16
- bold: %i[bold default],
17
- default: %i[default default],
18
- subtle: %i[light white],
19
- muted: %i[light gray],
20
- }.freeze
21
-
22
- WEIGHTS = {
23
- default: 0,
24
- bold: 1,
25
- light: 2,
26
- italic: 3,
27
- underline: 4,
28
- frame: 51,
29
- encircle: 52,
30
- overline: 53,
31
- }.freeze
32
-
33
- COLORS = {
34
- black: 30,
35
- red: 31,
36
- green: 32,
37
- yellow: 33,
38
- blue: 34,
39
- magenta: 35,
40
- cyan: 36,
41
- gray: 37, white: 97,
42
- default: 39,
43
- }.freeze
7
+ ESC = "\e["
44
8
 
9
+ Token = Struct.new(:style, :content) do
45
10
  def to_s
46
- "\e[#{weight};#{color}m#{content}#{reset}"
11
+ [
12
+ style_string,
13
+ content,
14
+ reset_string
15
+ ].join
47
16
  end
48
17
 
49
18
  private
50
19
 
51
- def weight
52
- WEIGHTS.fetch(style_components[0])
20
+ def style_string
21
+ "#{ESC}#{weight};#{color}m"
53
22
  end
54
23
 
55
- def color
56
- COLORS.fetch(style_components[1])
24
+ def reset_string
25
+ "#{ESC}0m"
26
+ end
27
+
28
+ def weight_key
29
+ style_components[0]
30
+ end
31
+
32
+ def color_key
33
+ style_components[1]
57
34
  end
58
35
 
59
- def reset
60
- "\e[0m"
36
+ def weight
37
+ {
38
+ default: 0,
39
+ bold: 1,
40
+ light: 2,
41
+ italic: 3
42
+ }.fetch(weight_key)
43
+ end
44
+
45
+ def color
46
+ {
47
+ black: 30,
48
+ red: 31,
49
+ green: 32,
50
+ yellow: 33,
51
+ blue: 34,
52
+ magenta: 35,
53
+ cyan: 36,
54
+ gray: 37,
55
+ default: 39
56
+ }.fetch(color_key)
61
57
  end
62
58
 
63
59
  def style_components
64
- STYLES[style]
60
+ {
61
+ success_bold: %i[bold green],
62
+ success: %i[default green],
63
+ slow: %i[default green],
64
+ error: %i[bold red],
65
+ broken: %i[bold red],
66
+ failure: %i[default red],
67
+ skipped: %i[bold yellow],
68
+ warning_light: %i[light yellow],
69
+ source: %i[italic default],
70
+ bold: %i[bold default],
71
+ default: %i[default default],
72
+ muted: %i[light gray]
73
+ }.fetch(style)
65
74
  end
66
75
  end
67
76
 
68
77
  FORMATTERS = {
69
78
  error: [
70
- [ %i[error label], %i[muted spacer], %i[error class], %i[muted arrow], %i[error test_name] ],
79
+ [ %i[error label], %i[muted arrow], %i[default test_name] ],
71
80
  [ %i[default summary], ],
72
81
  [ %i[default backtrace_summary] ],
73
82
  ],
74
83
  broken: [
75
- [ %i[broken label], %i[muted spacer], %i[broken test_class], %i[muted arrow], %i[broken test_name] ],
84
+ [ %i[broken label], %i[muted spacer], %i[default test_class], %i[muted arrow], %i[default test_name] ],
76
85
  [ %i[default summary], ],
77
86
  [ %i[default backtrace_summary] ],
78
87
  ],
79
88
  failure: [
80
- [ %i[failure label], %i[muted spacer], %i[failure test_class], %i[muted arrow], %i[failure test_name], %i[muted spacer], %i[muted class] ],
89
+ [ %i[failure label], %i[muted spacer], %i[default test_class], %i[muted arrow], %i[default test_name], %i[muted spacer], %i[muted class] ],
81
90
  [ %i[default summary] ],
82
- [ %i[subtle location], ],
91
+ [ %i[muted location], ],
83
92
  [ %i[default source_summary], ],
84
93
  ],
85
94
  skipped: [
86
- [ %i[skipped label], %i[muted spacer], %i[skipped test_class], %i[muted arrow], %i[skipped test_name] ],
87
- [ %i[default summary], %i[muted spacer], %i[default class] ],
95
+ [ %i[skipped label], %i[muted spacer], %i[default test_class], %i[muted arrow], %i[default test_name] ],
96
+ [ %i[default summary] ],
88
97
  [], # New Line
89
98
  ],
90
99
  slow: [
@@ -118,7 +127,7 @@ module Minitest
118
127
  when 'B' then text(:failure, value)
119
128
  when 'F' then text(:failure, value)
120
129
  when 'S' then text(:skipped, value)
121
- when 'T' then text(:slow, value)
130
+ when '_' then text(:success, value)
122
131
  else text(:success, value)
123
132
  end
124
133
  end
@@ -156,8 +165,6 @@ module Minitest
156
165
  text(:broken, 'B' * values[:broken].size) if values[:broken]&.any?
157
166
  text(:failure, 'F' * values[:failure].size) if values[:failure]&.any?
158
167
  text(:skipped, 'S' * values[:skipped].size) if values[:skipped]&.any?
159
- text(:slow, 'S' * values[:skipped].size) if values[:skipped]&.any?
160
-
161
168
  text(:muted, ' ')
162
169
 
163
170
  text(:muted, "#{path.delete_prefix('/')}")
@@ -169,7 +176,7 @@ module Minitest
169
176
  all_line_numbers += values.fetch(:skipped, [])
170
177
 
171
178
  line_numbers = all_line_numbers.compact.uniq.sort
172
- line_numbers.each { |line_number| text(:subtle, "#{line_number} ") }
179
+ line_numbers.each { |line_number| text(:muted, "#{line_number} ") }
173
180
  newline
174
181
  end
175
182
  newline
@@ -191,7 +198,7 @@ module Minitest
191
198
  text(:default, counts.join(', '))
192
199
 
193
200
  newline
194
- text(:subtle, "#{results.tests_per_second} tests/s and #{results.assertions_per_second} assertions/s ")
201
+ text(:muted, "#{results.tests_per_second} tests/s and #{results.assertions_per_second} assertions/s ")
195
202
 
196
203
  newline
197
204
  text(:muted, pluralize(results.test_count, 'Test') + ' & ')
@@ -218,7 +225,7 @@ module Minitest
218
225
  source = Minitest::Heat::Source.new(filename, line_number: line.number, max_line_count: 1)
219
226
 
220
227
  text(:muted, " #{line.path.delete_prefix("#{Dir.pwd}/")}/")
221
- text(:subtle, "#{line.file}:#{line.number}")
228
+ text(:muted, "#{line.file}:#{line.number}")
222
229
  text(:source, " `#{source.line.strip}`")
223
230
 
224
231
  newline
@@ -242,7 +249,7 @@ module Minitest
242
249
  number_style, line_style = if line == source.line && highlight_line
243
250
  [:default, :default]
244
251
  else
245
- [:subtle, :subtle]
252
+ [:muted, :muted]
246
253
  end
247
254
  text(number_style, "#{' ' * indentation}#{line_number.to_s.rjust(max_line_number_length)} ")
248
255
  text(line_style, line)
@@ -1,5 +1,5 @@
1
1
  module Minitest
2
2
  module Heat
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -80,8 +80,14 @@ module Minitest
80
80
  # pressing issues are displayed at the bottom of the report in order to reduce scrolling.
81
81
  # This way, as you fix issues, the list gets shorter, and eventually the least critical
82
82
  # issues will be displayed without scrolling once more problematic issues are resolved.
83
- results.slows.each { |issue| output.issue_details(issue) }
84
- results.skips.each { |issue| output.issue_details(issue) }
83
+ if results.failures.empty? && results.brokens.empty? && results.errors.empty? && results.skips.empty?
84
+ results.slows.each { |issue| output.issue_details(issue) }
85
+ end
86
+
87
+ if results.failures.empty? && results.brokens.empty? && results.errors.empty?
88
+ results.skips.each { |issue| output.issue_details(issue) }
89
+ end
90
+
85
91
  results.failures.each { |issue| output.issue_details(issue) }
86
92
  results.brokens.each { |issue| output.issue_details(issue) }
87
93
  results.errors.each { |issue| output.issue_details(issue) }
@@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  spec.add_runtime_dependency 'minitest'
36
36
 
37
+ spec.add_development_dependency 'dead_end'
37
38
  spec.add_development_dependency 'pry'
38
39
  spec.add_development_dependency 'simplecov'
39
40
  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.2
4
+ version: 0.0.3
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-29 00:00:00.000000000 Z
11
+ date: 2021-08-30 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: dead_end
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: pry
29
43
  requirement: !ruby/object:Gem::Requirement