minitest-heat 0.0.8 → 0.0.9

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: 3c787ecc1dc1259c0dd25a3f245476c353d7b2dcab4050876965470c1f117a17
4
- data.tar.gz: 1eab9c751b578a6eedfeffe8b7029df9699e25e7d9e644b2e472a47b3fba1f0d
3
+ metadata.gz: 1b06865dbf64c7b926b600aa635f27e00a0ac65cd08c25cc35ac2ee4de1768a0
4
+ data.tar.gz: 79ba518f1b7137992f35ac2489ac09c6d5687ae5a8c68e166995a63277e02f99
5
5
  SHA512:
6
- metadata.gz: 56ad59e3df9468d7157f43e7d033e9187a66da1c11e388286ad25d140094ace8219e5c86e86891afe587f86d2c11df3e16ef900cef7db815ca50df3e35320fe8
7
- data.tar.gz: 35fc16047ced8c8718b42cfcaa0cf0ee6796c8953f21f67db6edab23fc802a1659858bdffb77d853c4530359afea83417f6efa32485d7053d48b7baf568c7dff
6
+ metadata.gz: 3e5450a68e065e1573a21acba73537e2a003afdc098e7aab6eed2b41638c66a82d74a97faf3d94c9cb79c6279ebda7567dee4bd6a5bec75599e11c170c07e5dc
7
+ data.tar.gz: 8386cc9f07313cec0686e5efce192a9a7763b78a628ea0eb2b428890a7f5d43e30c472fe4dbcc65497fc2d908d7fc79457a5784890e583951b33dec964259cbf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minitest-heat (0.0.8)
4
+ minitest-heat (0.0.9)
5
5
  minitest
6
6
 
7
7
  GEM
@@ -44,7 +44,7 @@ module Minitest
44
44
  def to_hit
45
45
  [
46
46
  location.project_file.to_s,
47
- location.project_failure_line,
47
+ Integer(location.project_failure_line),
48
48
  type
49
49
  ]
50
50
  end
@@ -5,7 +5,7 @@ module Minitest
5
5
  class Output
6
6
  # Builds the collection of tokens for a backtrace when an exception occurs
7
7
  class Backtrace
8
- DEFAULT_LINE_COUNT = 5
8
+ DEFAULT_LINE_COUNT = 10
9
9
  DEFAULT_INDENTATION_SPACES = 2
10
10
 
11
11
  attr_accessor :location, :backtrace
@@ -83,17 +83,23 @@ module Minitest
83
83
  end
84
84
 
85
85
  def path_token(line)
86
+ style = line.to_s.include?(Dir.pwd) ? :default : :muted
86
87
  path = "#{line.path}/"
87
88
 
88
89
  # If all of the backtrace lines are from the project, no point in the added redundant
89
90
  # noise of showing the project root directory over and over again
90
91
  path = path.delete_prefix(project_root_dir) if all_backtrace_entries_from_project?
91
92
 
92
- [:muted, path]
93
+ [style, path]
93
94
  end
94
95
 
95
96
  def file_and_line_number_tokens(backtrace_entry)
96
- [[:default, backtrace_entry.file], [:muted, ':'], [:default, backtrace_entry.line_number]]
97
+ style = backtrace_entry.to_s.include?(Dir.pwd) ? :bold : :muted
98
+ [
99
+ [style, backtrace_entry.file],
100
+ [:muted, ':'],
101
+ [style, backtrace_entry.line_number]
102
+ ]
97
103
  end
98
104
 
99
105
  def source_code_line_token(source_code)
@@ -115,6 +121,10 @@ module Minitest
115
121
  def indentation
116
122
  DEFAULT_INDENTATION_SPACES
117
123
  end
124
+
125
+ def style_for(path)
126
+ style = path.to_s.include?(Dir.pwd) ? :default : :muted
127
+ end
118
128
  end
119
129
  end
120
130
  end
@@ -27,7 +27,6 @@ module Minitest
27
27
  [
28
28
  headline_tokens,
29
29
  test_location_tokens,
30
- location_tokens,
31
30
  summary_tokens,
32
31
  *backtrace_tokens,
33
32
  newline_tokens
@@ -103,9 +102,6 @@ module Minitest
103
102
  filename = issue.location.project_file
104
103
  line_number = issue.location.project_failure_line
105
104
 
106
- # source_code = ::Minitest::Heat::Output::SourceCode.new(filename, line_number, max_line_count: 1)
107
- # source_code.tokens
108
-
109
105
  source = Minitest::Heat::Source.new(filename, line_number: line_number)
110
106
  [[:muted, " #{Output::SYMBOLS[:arrow]} `#{source.line.strip}`"]]
111
107
  end
@@ -115,7 +111,13 @@ module Minitest
115
111
  end
116
112
 
117
113
  def slowness_summary_tokens
118
- [[:bold, issue.slowness], spacer_token, [:default, issue.short_location]]
114
+ [
115
+ [:bold, issue.slowness],
116
+ spacer_token,
117
+ [:default, issue.location.test_file.to_s.delete_prefix(Dir.pwd)],
118
+ [:muted, ':'],
119
+ [:default, issue.location.test_definition_line]
120
+ ]
119
121
  end
120
122
 
121
123
  def newline_tokens
@@ -146,25 +148,6 @@ module Minitest
146
148
  "\n #{source.line.strip}"
147
149
  end
148
150
 
149
-
150
- # def failure_summary_tokens
151
- # return unless issue_summary_lines.any?
152
-
153
- # # Sometimes, the exception message is multiple lines, so this adjusts the lines to
154
- # # visually group them together a bit
155
- # if issue_summary_lines.one?
156
- # [[[:italicized, issue_summary_lines.first]]]
157
- # else
158
- # issue_summary_lines.map do |line|
159
- # [Output::TOKENS[:muted_lead], [:italicized, line]]
160
- # end
161
- # end
162
- # end
163
-
164
- # def issue_summary_lines
165
- # @issue_summary_lines ||= issue.summary.split("\n")
166
- # end
167
-
168
151
  def spacer_token
169
152
  Output::TOKENS[:spacer]
170
153
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minitest
4
4
  module Heat
5
- VERSION = '0.0.8'
5
+ VERSION = '0.0.9'
6
6
  end
7
7
  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.8
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-10-15 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest