minitest-heat 0.0.8 → 0.0.9
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 +1 -1
- data/lib/minitest/heat/output/backtrace.rb +13 -3
- data/lib/minitest/heat/output/issue.rb +7 -24
- data/lib/minitest/heat/version.rb +1 -1
- 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: 1b06865dbf64c7b926b600aa635f27e00a0ac65cd08c25cc35ac2ee4de1768a0
|
4
|
+
data.tar.gz: 79ba518f1b7137992f35ac2489ac09c6d5687ae5a8c68e166995a63277e02f99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e5450a68e065e1573a21acba73537e2a003afdc098e7aab6eed2b41638c66a82d74a97faf3d94c9cb79c6279ebda7567dee4bd6a5bec75599e11c170c07e5dc
|
7
|
+
data.tar.gz: 8386cc9f07313cec0686e5efce192a9a7763b78a628ea0eb2b428890a7f5d43e30c472fe4dbcc65497fc2d908d7fc79457a5784890e583951b33dec964259cbf
|
data/Gemfile.lock
CHANGED
data/lib/minitest/heat/issue.rb
CHANGED
@@ -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 =
|
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
|
-
[
|
93
|
+
[style, path]
|
93
94
|
end
|
94
95
|
|
95
96
|
def file_and_line_number_tokens(backtrace_entry)
|
96
|
-
|
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
|
-
[
|
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
|
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-10-
|
11
|
+
date: 2021-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|