rspec_trunk_flaky_tests 0.12.1.pre.beta.12 → 0.12.9.pre.beta.0
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/lib/trunk_spec_helper.rb +3 -41
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '00089c490aca3f0766ade829dd6e96620cc900a7173fef7851d6844a8ebb7375'
|
|
4
|
+
data.tar.gz: 9a62065dccb28f61dbb2d440d6880a65b6e2174d4ae86634158fff88ab3cd5cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 561359db55239e235de3929888c2aa779d26afc05862477723c764e4821c9760d19dd44195e87bfa2f771fbb242392224b297944d861f5ccfd814d4a4ad22269
|
|
7
|
+
data.tar.gz: bf4fca81d43e248167cc4c3b4bc8c8495c87083f2c9c43201e9333caa0e48017f8948b2a6a01c02174f2a022b62f2f4372cdf792f8c417e877072e00b60f13ad
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -186,40 +186,9 @@ module RSpec
|
|
|
186
186
|
end
|
|
187
187
|
end
|
|
188
188
|
|
|
189
|
-
def format_exception_message(exception)
|
|
190
|
-
case exception
|
|
191
|
-
when RSpec::Core::MultipleExceptionError
|
|
192
|
-
# MultipleExceptionError contains multiple exceptions in @exceptions array
|
|
193
|
-
messages = exception.all_exceptions.map { |e| "#{e.class}: #{e.message}" }
|
|
194
|
-
"#{exception.class}: #{messages.join(' | ')}"
|
|
195
|
-
else
|
|
196
|
-
exception.to_s
|
|
197
|
-
end
|
|
198
|
-
end
|
|
199
|
-
|
|
200
|
-
# trunk-ignore(rubocop/Metrics/MethodLength)
|
|
201
|
-
def format_exception_backtrace(exception)
|
|
202
|
-
case exception
|
|
203
|
-
when RSpec::Core::MultipleExceptionError
|
|
204
|
-
# Collect backtraces from all nested exceptions
|
|
205
|
-
backtraces = exception.all_exceptions.map do |e|
|
|
206
|
-
if e.backtrace && !e.backtrace.empty?
|
|
207
|
-
"#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
208
|
-
else
|
|
209
|
-
"#{e.class}: #{e.message}"
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
backtraces.join("\n\n")
|
|
213
|
-
else
|
|
214
|
-
exception.backtrace&.join("\n") || ''
|
|
215
|
-
end
|
|
216
|
-
end
|
|
217
|
-
|
|
218
189
|
# TrunkAnalyticsListener is a class that is used to listen to the execution of the Example class
|
|
219
190
|
# it generates and submits the final test reports
|
|
220
191
|
class TrunkAnalyticsListener
|
|
221
|
-
MAX_TEXT_FIELD_SIZE = 8_000
|
|
222
|
-
|
|
223
192
|
def initialize
|
|
224
193
|
@testreport = $test_report
|
|
225
194
|
end
|
|
@@ -252,15 +221,8 @@ class TrunkAnalyticsListener
|
|
|
252
221
|
|
|
253
222
|
# trunk-ignore(rubocop/Metrics/CyclomaticComplexity,rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength)
|
|
254
223
|
def add_test_case(example)
|
|
255
|
-
|
|
256
|
-
failure_message =
|
|
257
|
-
backtrace = ''
|
|
258
|
-
if exception
|
|
259
|
-
failure_message = format_exception_message(exception)
|
|
260
|
-
backtrace = format_exception_backtrace(exception)
|
|
261
|
-
end
|
|
262
|
-
failure_message = failure_message[0...MAX_TEXT_FIELD_SIZE] if failure_message.length > MAX_TEXT_FIELD_SIZE
|
|
263
|
-
backtrace = backtrace[0...MAX_TEXT_FIELD_SIZE] if backtrace.length > MAX_TEXT_FIELD_SIZE
|
|
224
|
+
failure_message = example.exception.to_s if example.exception
|
|
225
|
+
failure_message = example.metadata[:quarantined_exception].to_s if example.metadata[:quarantined_exception]
|
|
264
226
|
# TODO: should we use concatenated string or alias when auto-generated description?
|
|
265
227
|
name = example.full_description
|
|
266
228
|
file = escape(example.metadata[:file_path])
|
|
@@ -285,7 +247,7 @@ class TrunkAnalyticsListener
|
|
|
285
247
|
parent_name = example.example_group.metadata[:description]
|
|
286
248
|
parent_name = parent_name.empty? ? 'rspec' : parent_name
|
|
287
249
|
@testreport.add_test(id, name, classname, file, parent_name, line, status, attempt_number,
|
|
288
|
-
started_at, finished_at, failure_message || '',
|
|
250
|
+
started_at, finished_at, failure_message || '', is_quarantined)
|
|
289
251
|
end
|
|
290
252
|
end
|
|
291
253
|
|