rspec_trunk_flaky_tests 0.12.8-arm64-darwin → 0.12.9-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 490c1ba70acf5b4d59f2fddfac4580426ee480b52df9efb325dd2b6dd481289f
4
- data.tar.gz: e41389da0c172f02227aa948cecfe875630e6cdf95c0233e42cdefb1e91c434f
3
+ metadata.gz: 71334d413030572e1a7d720f8807882d82d752ae16b4c73d3f0f793f8ceb7d86
4
+ data.tar.gz: e446bd913e8082fca75bd3f7ad5f0b73e3709b773966c62dfc5aefaaf4039617
5
5
  SHA512:
6
- metadata.gz: 5695899812444a36b800a50b028017bdca0add91113245a259e78f341b008aa016b5e7b7f52a356ddb7f41af8a8a2395dadc0c84e35787001c1abca32cfc5a1b
7
- data.tar.gz: e15e712eeafbe3c4ff62ca9dc40edaf5c3f6c869d0b310ddf4df7500ddcf1dd76dff5d45ea9836b19ba484dea58e3022abf2cc1a22ad5cc6fdd4f997e36b7cdf
6
+ metadata.gz: 72c0f80c3f8370c1e31ebdbe9d1bf2efdbd21b5a2914a348c956091cdfea96502b5fc109947f2e15f021e1bb25c5aeb4cb89a2e1470be0b1f38ecdda343b45fa
7
+ data.tar.gz: f657f4285de327d5ed28cea140a2e74bd91126079ae68f82456389cdb7180c26ce0e227521940e3da5cc6053653ac4beea182f05a15aad62880c78242fa14a54
@@ -4,5 +4,31 @@ begin
4
4
  ruby_version = /(\d+\.\d+)/.match(RUBY_VERSION)
5
5
  require_relative "rspec_trunk_flaky_tests/#{ruby_version}/rspec_trunk_flaky_tests"
6
6
  rescue LoadError
7
- require_relative 'rspec_trunk_flaky_tests/rspec_trunk_flaky_tests'
7
+ begin
8
+ require_relative 'rspec_trunk_flaky_tests/rspec_trunk_flaky_tests'
9
+ rescue LoadError
10
+ raise LoadError, <<~MSG
11
+ Could not load the native extension for rspec_trunk_flaky_tests.
12
+
13
+ You are using the pure ruby variant of this gem, which is a placeholder
14
+ that exists so that Gemfile.lock files with `PLATFORMS ruby` can resolve
15
+ this dependency. It does not include a precompiled native extension.
16
+
17
+ Precompiled native gems are available for:
18
+ x86_64-linux, aarch64-linux, arm64-darwin, x86_64-darwin
19
+
20
+ If you are on a supported platform and seeing this error, make sure
21
+ bundler is selecting the native variant for your platform:
22
+
23
+ bundle lock --add-platform #{RUBY_PLATFORM}
24
+ bundle install
25
+
26
+ If you are on an unsupported platform, this gem cannot be used in your
27
+ environment. Please open an issue at:
28
+ https://github.com/trunk-io/analytics-cli/issues
29
+
30
+ Current platform: #{RUBY_PLATFORM}
31
+ Current Ruby version: #{RUBY_VERSION}
32
+ MSG
33
+ end
8
34
  end
@@ -186,9 +186,40 @@ 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
221
+ MAX_TEXT_FIELD_SIZE = 8_000
222
+
192
223
  def initialize
193
224
  @testreport = $test_report
194
225
  end
@@ -221,8 +252,15 @@ class TrunkAnalyticsListener
221
252
 
222
253
  # trunk-ignore(rubocop/Metrics/CyclomaticComplexity,rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength)
223
254
  def add_test_case(example)
224
- failure_message = example.exception.to_s if example.exception
225
- failure_message = example.metadata[:quarantined_exception].to_s if example.metadata[:quarantined_exception]
255
+ exception = example.exception || example.metadata[:quarantined_exception]
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
226
264
  # TODO: should we use concatenated string or alias when auto-generated description?
227
265
  name = example.full_description
228
266
  file = escape(example.metadata[:file_path])
@@ -247,7 +285,7 @@ class TrunkAnalyticsListener
247
285
  parent_name = example.example_group.metadata[:description]
248
286
  parent_name = parent_name.empty? ? 'rspec' : parent_name
249
287
  @testreport.add_test(id, name, classname, file, parent_name, line, status, attempt_number,
250
- started_at, finished_at, failure_message || '', is_quarantined)
288
+ started_at, finished_at, failure_message || '', backtrace || '', is_quarantined)
251
289
  end
252
290
  end
253
291
 
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.8
4
+ version: 0.12.9
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-04-08 00:00:00.000000000 Z
11
+ date: 2026-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -57,7 +57,8 @@ files:
57
57
  homepage: https://docs.trunk.io/flaky-tests/get-started/frameworks/rspec
58
58
  licenses:
59
59
  - MIT
60
- metadata: {}
60
+ metadata:
61
+ source_code_uri: https://github.com/trunk-io/analytics-cli/tree/main/rspec-trunk-flaky-tests
61
62
  post_install_message:
62
63
  rdoc_options: []
63
64
  require_paths: