rspec_trunk_flaky_tests 0.12.9.pre.beta.1 → 0.12.9.pre.beta.3
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 +31 -2
- 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: f95bf2994b1d784c35b84bcec3cf9e178e419ee9883d245ce412c9a1503df71c
|
|
4
|
+
data.tar.gz: a56c86685c55567e886d1f8767d930f6edd6902bb134c031b3001ccf254e2e21
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '09046df252059047b1d30de72c740839f749705d9c0c64ce7c9f5bb6bc9bb7397e37ba99893767bf490075273929ef90ec53c088bb9b76702893840ad6b37e0d'
|
|
7
|
+
data.tar.gz: 0ca103d830aabd876e323cd2e13859d037f4fe8fcf3aeb6e963f881bd6980f8160786ddb6ada06a36884b613316fe6c80a43ccd4e4064020bc16040b05934690
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -186,6 +186,35 @@ 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
|
+
|
|
189
218
|
# TrunkAnalyticsListener is a class that is used to listen to the execution of the Example class
|
|
190
219
|
# it generates and submits the final test reports
|
|
191
220
|
class TrunkAnalyticsListener
|
|
@@ -227,8 +256,8 @@ class TrunkAnalyticsListener
|
|
|
227
256
|
failure_message = ''
|
|
228
257
|
backtrace = ''
|
|
229
258
|
if exception
|
|
230
|
-
failure_message = exception
|
|
231
|
-
backtrace = exception
|
|
259
|
+
failure_message = format_exception_message(exception)
|
|
260
|
+
backtrace = format_exception_backtrace(exception)
|
|
232
261
|
end
|
|
233
262
|
failure_message = failure_message[0...MAX_TEXT_FIELD_SIZE] if failure_message.length > MAX_TEXT_FIELD_SIZE
|
|
234
263
|
backtrace = backtrace[0...MAX_TEXT_FIELD_SIZE] if backtrace.length > MAX_TEXT_FIELD_SIZE
|