rspec_trunk_flaky_tests 0.13.7.pre.beta.1-arm64-darwin → 0.14.0-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: ff395ba59ea3c6c0702093e63fbd16aaf38c0063b57a3ed991c46d45687b9c6d
4
- data.tar.gz: a50a18a73832b63b908f03355c4a32d7095d1a9f25dd2b650f243249f36e6619
3
+ metadata.gz: d568a9ea6ac6dff18ba7708a436b4d63acc5e713da4265ab41d92a4503b599e6
4
+ data.tar.gz: d0a00946d5587b4ada9f7c9bdb71d59231d325745ec8dcec0a428db853e7c541
5
5
  SHA512:
6
- metadata.gz: f7d42cded84d8da7985b794345ffd7fe848a89e8c74abdb7fca400121041d5d893f07c617fca5194b4903faf0ebe2fad6844317ea18289e29482aa287b332edb
7
- data.tar.gz: 873dc3e24334e08cb129b4289fa388cd790d5c415a50464a75bbfaa9bead376c71724d2b6fd653ce601550808c72c4276f936f14f5858532ce1aa89c5c21e1aa
6
+ metadata.gz: 7e245a2b4cdb378c904afee98c7fa0e814980fa485d4ebb01dc974458f19f23469a73fcff1a09f3f7c3308578070227c2d8baaff3cb379d42bdea885e1a78809
7
+ data.tar.gz: 8cbdb9f0f426636a1f5c972bb357376855f853d3209fbc436172c849b928c2aafc792ad4ac35d522bd08679c2aa9567b97b98bb71a110bdccdf0eaee06941a97
@@ -15,7 +15,8 @@ rescue LoadError
15
15
  this dependency. It does not include a precompiled native extension.
16
16
 
17
17
  Precompiled native gems are available for:
18
- x86_64-linux, aarch64-linux, arm64-darwin, x86_64-darwin
18
+ x86_64-linux-gnu, x86_64-linux-musl, aarch64-linux-gnu,
19
+ aarch64-linux-musl, arm64-darwin, x86_64-darwin
19
20
 
20
21
  If you are on a supported platform and seeing this error, make sure
21
22
  bundler is selecting the native variant for your platform:
@@ -108,11 +108,25 @@ module RSpec
108
108
  # decide if we want to fail the test or not
109
109
  # trunk-ignore(rubocop/Naming/AccessorMethodName)
110
110
  def set_exception(exception)
111
- return set_exception_core(exception) if metadata[:pending]
111
+ # Pending stays green, except a fixed pending example is a real failure.
112
+ return set_exception_core(exception) if metadata[:pending] && !pending_example_fixed?(exception)
112
113
  return set_exception_core(exception) if trunk_disabled
113
114
  return set_exception_core(exception) if metadata[:retry_attempts]&.positive?
114
115
 
116
+ handle_quarantine_check_safely(exception)
117
+ end
118
+
119
+ # If the quarantine machinery itself blows up, the failure must stand.
120
+ def handle_quarantine_check_safely(exception)
115
121
  handle_quarantine_check(exception)
122
+ rescue StandardError => e
123
+ puts "Quarantine check errored (#{e.class}: #{e.message}), treating test as not quarantined".yellow
124
+ set_exception_core(exception)
125
+ end
126
+
127
+ def pending_example_fixed?(exception)
128
+ defined?(RSpec::Core::Pending::PendingExampleFixedError) &&
129
+ exception.is_a?(RSpec::Core::Pending::PendingExampleFixedError)
116
130
  end
117
131
 
118
132
  # trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength,rubocop/Metrics/CyclomaticComplexity)
@@ -336,7 +350,7 @@ class TrunkAnalyticsListener
336
350
 
337
351
  # trunk-ignore(rubocop/Metrics/CyclomaticComplexity,rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength)
338
352
  def add_test_case(example)
339
- exception = example.exception || example.metadata[:quarantined_exception]
353
+ status, exception = status_and_exception(example)
340
354
  failure_message = ''
341
355
  backtrace = ''
342
356
  if exception
@@ -355,22 +369,63 @@ class TrunkAnalyticsListener
355
369
  id = example.generate_trunk_id
356
370
 
357
371
  attempt_number = example.metadata[:retry_attempts] || example.metadata[:attempt_number] || 0
358
- status = example.execution_result.status.to_s
359
372
  # set the status to failure, but mark it as quarantined
360
373
  is_quarantined = example.metadata[:quarantined_exception] ? true : false
361
- case example.execution_result.status
362
- when :passed
363
- status = is_quarantined ? Status.new('failure') : Status.new('success')
364
- when :failed
365
- status = Status.new('failure')
366
- when :pending
367
- status = Status.new('skipped')
368
- end
369
374
  parent_name = example.example_group.metadata[:description]
370
375
  parent_name = parent_name.empty? ? 'rspec' : parent_name
371
376
  @testreport.add_test(id, name, classname, file, parent_name, line, status, attempt_number,
372
377
  started_at, finished_at, failure_message || '', backtrace || '', is_quarantined)
373
378
  end
379
+
380
+ # Determine the Trunk status to report for an example, plus the exception (if
381
+ # any) whose message/backtrace should be recorded for it.
382
+ #
383
+ # `pending` examples need care because RSpec expresses their outcome as the
384
+ # inverse of the body's pass/fail. A pending example's contract is "this is
385
+ # expected to fail", so:
386
+ # - body still fails -> expectation met -> RSpec status :pending, build green
387
+ # - body now passes -> expectation violated -> RSpec status :failed
388
+ # (PendingExampleFixedError), build red
389
+ # We report the outcome RSpec actually decided, which also matches the build
390
+ # result:
391
+ # - skip / xit (never ran) -> skipped
392
+ # - pending, body still failing -> success (expectation met)
393
+ # - pending, body now passing -> failure (PendingExampleFixedError)
394
+ # RSpec's own build pass/fail behavior is left untouched (see #set_exception).
395
+ #
396
+ # trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/CyclomaticComplexity,rubocop/Metrics/MethodLength)
397
+ def status_and_exception(example)
398
+ result = example.execution_result
399
+ quarantined_exception = example.metadata[:quarantined_exception]
400
+
401
+ # A genuinely skipped example (`skip`/`xit`, or `skip` called from a hook or
402
+ # body) never runs, so it has no real pass/fail outcome. RSpec still reports
403
+ # it with status :pending, so detect skips explicitly -- and up front -- via
404
+ # metadata[:skip] before interpreting any pending pass/fail semantics below.
405
+ return [Status.new('skipped'), nil] if example.metadata[:skip]
406
+
407
+ case result.status
408
+ when :passed
409
+ # A quarantined failure is recorded as :passed by RSpec (see #set_exception),
410
+ # so report it as a failure but carry the original quarantined exception.
411
+ quarantined_exception ? [Status.new('failure'), quarantined_exception] : [Status.new('success'), nil]
412
+ when :failed
413
+ # Includes a pending example whose body unexpectedly passed: RSpec reports it
414
+ # as :failed with a PendingExampleFixedError (on example.exception) and breaks
415
+ # the build (the pending expectation was violated), so it is a failure here too.
416
+ [Status.new('failure'), example.exception || quarantined_exception]
417
+ when :pending
418
+ # A quarantined fixed-pending is left :pending but pending_fixed? -- still a
419
+ # failure. Otherwise the pending "should fail" expectation was met -> success.
420
+ if result.pending_fixed?
421
+ [Status.new('failure'), quarantined_exception || example.exception]
422
+ else
423
+ [Status.new('success'), nil]
424
+ end
425
+ else
426
+ [Status.new(result.status.to_s), example.exception || quarantined_exception]
427
+ end
428
+ end
374
429
  end
375
430
 
376
431
  RSpec.configure do |c|
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.13.7.pre.beta.1
4
+ version: 0.14.0
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-07-06 00:00:00.000000000 Z
11
+ date: 2026-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -47,7 +47,6 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - lib/rspec_trunk_flaky_tests.rb
50
- - lib/rspec_trunk_flaky_tests/3.0/rspec_trunk_flaky_tests.bundle
51
50
  - lib/rspec_trunk_flaky_tests/3.1/rspec_trunk_flaky_tests.bundle
52
51
  - lib/rspec_trunk_flaky_tests/3.2/rspec_trunk_flaky_tests.bundle
53
52
  - lib/rspec_trunk_flaky_tests/3.3/rspec_trunk_flaky_tests.bundle
@@ -67,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
66
  requirements:
68
67
  - - ">="
69
68
  - !ruby/object:Gem::Version
70
- version: '3.0'
69
+ version: '3.1'
71
70
  - - "<"
72
71
  - !ruby/object:Gem::Version
73
72
  version: 4.1.dev