rspec_trunk_flaky_tests 0.12.1.pre.beta.1-arm64-darwin → 0.12.2-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: 45f0425cc78c2401f9e5cb60b3a027da0f47951eaa9a94a3a2a44e472cd68747
4
- data.tar.gz: f6bff613aefaaf1691ea9980d0b77f65f0a183dacc7108fe7e57604b7784c160
3
+ metadata.gz: 2c62705bcb40876e1a2701d3352835931d464577d23de9599589ee8e462c8d9a
4
+ data.tar.gz: 7490e115ee002688af7bf51a2a68b6942b2dae441362236a9327d76ec8d95844
5
5
  SHA512:
6
- metadata.gz: dc80d2f70d6b1e7ed1e6f52586cf4ab5c35cee784a8acc7af742f4528b2ce0afa46929ca1b8dbb1dd201013c1f86d4218d0f25fb6fdf669fc446ddc9ef52f815
7
- data.tar.gz: 6931066bdf58084b4795100acfca30eaf3d28a6cd9b2bf9c76c47d46c3e8b484c79c436b31c411bbe1e450c917552cf40f346806f1e863e3439821a069384635
6
+ metadata.gz: dc6c6d2f2514e4a91e308ac11f781e768214595d55148187b7c51277080f15cbeeb1368e44073061d256f1c4c734d222612247d48808f1e4dc10fef3515b7653
7
+ data.tar.gz: bc66d9be93e8d213d6b93d56176877d3ef13d9cba6cba337e3cae248b68feb00e0e1e5afe039a3f5e5b761e5feb7642e79eee5dc7bc410d10b4de3d56713d888
@@ -25,6 +25,7 @@
25
25
  # TRUNK_DRY_RUN - Set to 'true' to save bundle locally instead of uploading
26
26
  # TRUNK_USE_UNCLONED_REPO - Set to 'true' for uncloned repo mode
27
27
  # TRUNK_LOCAL_UPLOAD_DIR - Directory to save test results locally (disables upload)
28
+ # TRUNK_QUARANTINED_TESTS_DISK_CACHE_TTL_SECS - Time to cache quarantined tests on disk (in seconds)
28
29
  # DISABLE_RSPEC_TRUNK_FLAKY_TESTS - Set to 'true' to completely disable Trunk
29
30
  #
30
31
  require 'rspec/core'
@@ -72,8 +73,9 @@ def trunk_disabled
72
73
  ENV['TRUNK_ORG_URL_SLUG'].nil? || ENV['TRUNK_API_TOKEN'].nil?
73
74
  end
74
75
 
75
- # we want to cache the test report so we can add to it as we go and reduce the number of API calls
76
+ # we want to cache the test report in memory so we can add to it as we go and reduce the number of API calls
76
77
  $test_report = TestReport.new('rspec', "#{$PROGRAM_NAME} #{ARGV.join(' ')}", nil)
78
+ $failure_encountered_and_quarantining_disabled = false
77
79
 
78
80
  module RSpec
79
81
  module Core
@@ -85,20 +87,34 @@ module RSpec
85
87
  # RSpec uses the existance of an exception to determine if the test failed
86
88
  # We need to override this to allow us to capture the exception and then
87
89
  # decide if we want to fail the test or not
88
- # trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength,rubocop/Naming/AccessorMethodName)
90
+ # trunk-ignore(rubocop/Naming/AccessorMethodName)
89
91
  def set_exception(exception)
90
92
  return set_exception_core(exception) if metadata[:pending]
91
93
  return set_exception_core(exception) if trunk_disabled
92
94
  return set_exception_core(exception) if metadata[:retry_attempts]&.positive?
93
95
 
96
+ handle_quarantine_check(exception)
97
+ end
98
+
99
+ # trunk-ignore(rubocop/Metrics/AbcSize,rubocop/Metrics/MethodLength)
100
+ def handle_quarantine_check(exception)
94
101
  id = generate_trunk_id
95
102
  name = full_description
96
103
  parent_name = example_group.metadata[:description]
97
104
  parent_name = parent_name.empty? ? 'rspec' : parent_name
98
105
  file = escape(metadata[:file_path])
99
106
  classname = file.sub(%r{\.[^/.]+\Z}, '').gsub('/', '.').gsub(/\A\.+|\.+\Z/, '')
100
- puts "Test failed, checking if it can be quarantined: `#{location}`".yellow
101
- if $test_report.is_quarantined(id, name, parent_name, classname, file)
107
+ unless $failure_encountered_and_quarantining_disabled
108
+ puts "Test failed, checking if it can be quarantined: `#{location}`".yellow
109
+ end
110
+ is_quarantined_result = $test_report.is_quarantined(id, name, parent_name, classname, file)
111
+ if is_quarantined_result.quarantining_disabled_for_repo
112
+ unless $failure_encountered_and_quarantining_disabled
113
+ puts 'Quarantining is disabled for this repo, no failures will be quarantined'.yellow
114
+ $failure_encountered_and_quarantining_disabled = true
115
+ end
116
+ set_exception_core(exception)
117
+ elsif is_quarantined_result.test_is_quarantined
102
118
  # monitor the override in the metadata
103
119
  metadata[:quarantined_exception] = exception
104
120
  puts "Test is quarantined, overriding exception: #{exception}".green
@@ -181,6 +197,9 @@ class TrunkAnalyticsListener
181
197
 
182
198
  # trunk-ignore(rubocop/Metrics/MethodLength)
183
199
  def close(_notification)
200
+ if $failure_encountered_and_quarantining_disabled
201
+ puts 'Note: Quarantining is disabled for this repo. Test failures were not quarantined.'.yellow
202
+ end
184
203
  if ENV['TRUNK_LOCAL_UPLOAD_DIR']
185
204
  saved = @testreport.try_save(ENV['TRUNK_LOCAL_UPLOAD_DIR'])
186
205
  if saved
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.1.pre.beta.1
4
+ version: 0.12.2
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: 2025-12-19 00:00:00.000000000 Z
11
+ date: 2026-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core
@@ -52,6 +52,7 @@ files:
52
52
  - lib/rspec_trunk_flaky_tests/3.2/rspec_trunk_flaky_tests.bundle
53
53
  - lib/rspec_trunk_flaky_tests/3.3/rspec_trunk_flaky_tests.bundle
54
54
  - lib/rspec_trunk_flaky_tests/3.4/rspec_trunk_flaky_tests.bundle
55
+ - lib/rspec_trunk_flaky_tests/4.0/rspec_trunk_flaky_tests.bundle
55
56
  - lib/trunk_spec_helper.rb
56
57
  homepage: https://docs.trunk.io/flaky-tests/get-started/frameworks/rspec
57
58
  licenses:
@@ -68,7 +69,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
68
69
  version: '3.0'
69
70
  - - "<"
70
71
  - !ruby/object:Gem::Version
71
- version: 3.5.dev
72
+ version: 4.1.dev
72
73
  required_rubygems_version: !ruby/object:Gem::Requirement
73
74
  requirements:
74
75
  - - ">="