rspec_trunk_flaky_tests 0.12.9.pre.beta.3-arm64-darwin → 0.12.10-arm64-darwin
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/rspec_trunk_flaky_tests/3.0/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/rspec_trunk_flaky_tests/3.1/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/rspec_trunk_flaky_tests/3.2/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/rspec_trunk_flaky_tests/3.3/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/rspec_trunk_flaky_tests/3.4/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/rspec_trunk_flaky_tests/4.0/rspec_trunk_flaky_tests.bundle +0 -0
- data/lib/trunk_spec_helper.rb +72 -13
- 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: 951541aef1940dcb97a9e6c40cfc4c0e2b562c43e6c10e4a2a0e6020f4e39199
|
|
4
|
+
data.tar.gz: c60b2fb1e02452467a672dc9e9f448b4b714cbbde89597da4635cff1cde0a600
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c882c7f4378bb3fdda95ef4706ba7ad9bf40c3241dc09188aa6796d60de9cce92661c1f8c9ae7e0a814cdb1264e99aed2dcfc53774a5c590a920f834133f9396
|
|
7
|
+
data.tar.gz: 96554dc7b5cd627140882692b9c7289c590dde5ce2495e5a84403fcf06c311d42e929a1480c38086e177a784e28beb842db1f24278f37d1cd01aecb56804d7a2
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/lib/trunk_spec_helper.rb
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
# DISABLE_RSPEC_TRUNK_FLAKY_TESTS - Set to 'true' to completely disable Trunk
|
|
31
31
|
#
|
|
32
32
|
require 'rspec/core'
|
|
33
|
+
require 'rspec/core/formatters/exception_presenter'
|
|
33
34
|
require 'time'
|
|
34
35
|
require 'rspec_trunk_flaky_tests'
|
|
35
36
|
|
|
@@ -53,10 +54,16 @@ class String
|
|
|
53
54
|
end
|
|
54
55
|
end
|
|
55
56
|
|
|
57
|
+
ANSI_ESCAPE_PATTERN = %r{(?:\e[@-Z\\-_]|\e\[[0-?]*[ -/]*[@-~])}
|
|
58
|
+
|
|
56
59
|
def escape(str)
|
|
57
60
|
str.dump[1..-2]
|
|
58
61
|
end
|
|
59
62
|
|
|
63
|
+
def strip_ansi_codes(text)
|
|
64
|
+
text.to_s.gsub(ANSI_ESCAPE_PATTERN, '')
|
|
65
|
+
end
|
|
66
|
+
|
|
60
67
|
# Knapsack example detector instantiates all test cases in order to determine how to shard them
|
|
61
68
|
# These instantiations should not generate test bundles, so we
|
|
62
69
|
# disable the gem when running under knapsack_pro:rspec_test_example_detector
|
|
@@ -186,32 +193,84 @@ module RSpec
|
|
|
186
193
|
end
|
|
187
194
|
end
|
|
188
195
|
|
|
189
|
-
|
|
196
|
+
# PlainColorizer is a no-op colorizer passed to RSpec's ExceptionPresenter so the
|
|
197
|
+
# formatted output is plain text suitable for storage and the web UI.
|
|
198
|
+
module PlainColorizer
|
|
199
|
+
module_function
|
|
200
|
+
|
|
201
|
+
def wrap(text, _code_or_symbol)
|
|
202
|
+
text
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
# Defer to RSpec's own ExceptionPresenter so the failure_message field matches
|
|
207
|
+
# what users see in their RSpec console output (Failure/Error: <source line>,
|
|
208
|
+
# the exception class and message, and any "Caused by:" chain).
|
|
209
|
+
def format_exception_message(exception, example)
|
|
210
|
+
return '' unless exception
|
|
211
|
+
|
|
212
|
+
presenter = RSpec::Core::Formatters::ExceptionPresenter.new(exception, example)
|
|
213
|
+
strip_ansi_codes(presenter.fully_formatted(nil, PlainColorizer))
|
|
214
|
+
rescue StandardError
|
|
215
|
+
legacy_format_exception_message(exception)
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
# trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
|
|
219
|
+
def format_exception_backtrace(exception, example)
|
|
220
|
+
return '' unless exception
|
|
221
|
+
|
|
222
|
+
lines = exception_backtrace_lines(exception, example)
|
|
223
|
+
|
|
224
|
+
cause = exception.cause
|
|
225
|
+
depth = 0
|
|
226
|
+
while cause && depth < 10
|
|
227
|
+
lines << ''
|
|
228
|
+
lines << "Caused by: #{cause.class}: #{cause.message}"
|
|
229
|
+
lines.concat(exception_backtrace_lines(cause, example))
|
|
230
|
+
cause = cause.cause
|
|
231
|
+
depth += 1
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
result = lines.join("\n")
|
|
235
|
+
# The exception presenter may choke on MultipleExceptionError, such as errors in before
|
|
236
|
+
# and after hooks, so we fall back to the legacy formatter
|
|
237
|
+
return legacy_format_exception_backtrace(exception) if result.strip.empty?
|
|
238
|
+
|
|
239
|
+
strip_ansi_codes(result)
|
|
240
|
+
rescue StandardError
|
|
241
|
+
legacy_format_exception_backtrace(exception)
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
def exception_backtrace_lines(exception, example)
|
|
245
|
+
presenter = RSpec::Core::Formatters::ExceptionPresenter.new(exception, example)
|
|
246
|
+
Array(presenter.formatted_backtrace)
|
|
247
|
+
rescue StandardError
|
|
248
|
+
Array(exception.backtrace)
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
def legacy_format_exception_message(exception)
|
|
190
252
|
case exception
|
|
191
253
|
when RSpec::Core::MultipleExceptionError
|
|
192
|
-
# MultipleExceptionError contains multiple exceptions in @exceptions array
|
|
193
254
|
messages = exception.all_exceptions.map { |e| "#{e.class}: #{e.message}" }
|
|
194
|
-
"#{exception.class}: #{messages.join(' | ')}"
|
|
255
|
+
strip_ansi_codes("#{exception.class}: #{messages.join(' | ')}")
|
|
195
256
|
else
|
|
196
|
-
exception.to_s
|
|
257
|
+
strip_ansi_codes(exception.to_s)
|
|
197
258
|
end
|
|
198
259
|
end
|
|
199
260
|
|
|
200
|
-
# trunk-ignore(rubocop/Metrics/MethodLength)
|
|
201
|
-
def
|
|
261
|
+
# trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
|
|
262
|
+
def legacy_format_exception_backtrace(exception)
|
|
202
263
|
case exception
|
|
203
264
|
when RSpec::Core::MultipleExceptionError
|
|
204
|
-
|
|
205
|
-
backtraces = exception.all_exceptions.map do |e|
|
|
265
|
+
strip_ansi_codes(exception.all_exceptions.map do |e|
|
|
206
266
|
if e.backtrace && !e.backtrace.empty?
|
|
207
267
|
"#{e.class}: #{e.message}\n#{e.backtrace.join("\n")}"
|
|
208
268
|
else
|
|
209
269
|
"#{e.class}: #{e.message}"
|
|
210
270
|
end
|
|
211
|
-
end
|
|
212
|
-
backtraces.join("\n\n")
|
|
271
|
+
end.join("\n\n"))
|
|
213
272
|
else
|
|
214
|
-
exception.backtrace&.join("\n") || ''
|
|
273
|
+
strip_ansi_codes(exception.backtrace&.join("\n") || '')
|
|
215
274
|
end
|
|
216
275
|
end
|
|
217
276
|
|
|
@@ -256,8 +315,8 @@ class TrunkAnalyticsListener
|
|
|
256
315
|
failure_message = ''
|
|
257
316
|
backtrace = ''
|
|
258
317
|
if exception
|
|
259
|
-
failure_message = format_exception_message(exception)
|
|
260
|
-
backtrace = format_exception_backtrace(exception)
|
|
318
|
+
failure_message = format_exception_message(exception, example).strip
|
|
319
|
+
backtrace = format_exception_backtrace(exception, example).strip
|
|
261
320
|
end
|
|
262
321
|
failure_message = failure_message[0...MAX_TEXT_FIELD_SIZE] if failure_message.length > MAX_TEXT_FIELD_SIZE
|
|
263
322
|
backtrace = backtrace[0...MAX_TEXT_FIELD_SIZE] if backtrace.length > MAX_TEXT_FIELD_SIZE
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rspec_trunk_flaky_tests
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.12.
|
|
4
|
+
version: 0.12.10
|
|
5
5
|
platform: arm64-darwin
|
|
6
6
|
authors:
|
|
7
7
|
- Trunk Technologies, Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-05-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec-core
|