rspec_trunk_flaky_tests 0.16.2.pre.beta.4-aarch64-linux-gnu → 0.17.0-aarch64-linux-gnu

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: 0ca903837d133f8bc9697d02304aefd25b418c2354ddd4fa393c3d7e1f1e9e7c
4
- data.tar.gz: 64ada43427a7f3721dd09f6e3c784a24f5be71666f2a9ac1444aef01dd8c6ad5
3
+ metadata.gz: fb7cebc6516c92130d27797b95a38584af93424386226d1dde50c3508d29a966
4
+ data.tar.gz: aeb10d087660c152507745a9cbdf90b766e2edcf3868ebef64a1f0bafe08202c
5
5
  SHA512:
6
- metadata.gz: e41aff59fc85dce91107915b0a4856537cf6c64f8ae313a5ac576ea8630b4329c4c4f098330d968b043ff25fa8b0e87cc443feedcb8afb6b41d18cc4d554b32f
7
- data.tar.gz: c16d278a950e875c432b380e33bc7a87e3b4b86691eb0ef9d668faac449ab5be6987da446b336374e767826d4cf9b1746847090b12e6e274b318f2b75b9a0954
6
+ metadata.gz: 5171b7dad07e790cd134d29c600094ed806d44228a23636e8effac0bc9b06888451fa640eda58e4e9b9d2a30c27dd3f09192a74951a013bb524f9ece268b0651
7
+ data.tar.gz: ffb04ce3d2ad2322c24351c4e4c8ccc923ddd67fc61880b856a5ded56d031a518ac397f4bfbf32ec46b4d1e53602d78e432f271190fe1b399e0fd3fa6f1c1e31
@@ -27,6 +27,7 @@
27
27
  # TRUNK_DRY_RUN - Set to 'true' to save bundle locally instead of uploading
28
28
  # TRUNK_USE_UNCLONED_REPO - Set to 'true' for uncloned repo mode
29
29
  # TRUNK_LOCAL_UPLOAD_DIR - Directory to save test results locally (disables upload)
30
+ # TRUNK_SUMMARY_OUTPUT_FILE - Path to write a JSON summary of the uploaded results to
30
31
  # TRUNK_QUARANTINED_TESTS_DISK_CACHE_TTL_SECS - Time to cache quarantined tests on disk (in seconds)
31
32
  # TRUNK_QUARANTINE_QUERY_FAILURE_EXIT - Set to 'true' to abort the RSpec run when quarantine
32
33
  # lookup fails (remaining examples are skipped)
@@ -45,6 +46,15 @@ module RSpec
45
46
  module Trunk
46
47
  ANSI_ESCAPE_PATTERN = %r{(?:\e[@-Z\\-_]|\e\[[0-?]*[ -/]*[@-~])}
47
48
 
49
+ CORE_METHODS = {
50
+ name: [Module.instance_method(:name), String],
51
+ class: [Kernel.instance_method(:class), Module]
52
+ }.freeze
53
+ CLASS_SUPERCLASS = Class.instance_method(:superclass)
54
+ KERNEL_IS_A = Kernel.instance_method(:is_a?)
55
+ MODULE_TO_S = Module.instance_method(:to_s)
56
+ MEMORY_ADDRESS = /:0x\h+>/
57
+
48
58
  # Knapsack example detector instantiates all test cases in order to determine how to shard them
49
59
  # These instantiations should not generate test bundles, so we
50
60
  # disable the gem when running under knapsack_pro:rspec_test_example_detector
@@ -63,6 +73,7 @@ module RSpec
63
73
  trunk_is_description_generated: :is_description_generated
64
74
  }.freeze
65
75
 
76
+ # trunk-ignore(rubocop/Metrics/ClassLength)
66
77
  class << self
67
78
  # The state for this RSpec process, or nil when Trunk is disabled.
68
79
  attr_reader :current_run
@@ -106,6 +117,10 @@ module RSpec
106
117
  ENV['TRUNK_QUARANTINE_QUERY_FAILURE_EXIT'] == 'true'
107
118
  end
108
119
 
120
+ def disable_quarantining?
121
+ ENV['TRUNK_DISABLE_QUARANTINING'] == 'true'
122
+ end
123
+
109
124
  def command_line
110
125
  "#{$PROGRAM_NAME} #{ARGV.join(' ')}"
111
126
  end
@@ -180,21 +195,51 @@ module RSpec
180
195
  end
181
196
 
182
197
  def description_arg(arg)
183
- if arg.is_a?(Module)
184
- arg.name || anonymous_module_name(arg)
198
+ if core_is_a?(arg, Module)
199
+ module_description(arg, arg.to_s)
185
200
  elsif default_to_s?(arg)
186
- "#<#{arg.class.name || anonymous_module_name(arg.class)}>"
201
+ klass = core_call(arg, :class)
202
+ "#<#{module_description(klass, MODULE_TO_S.bind_call(klass))}>"
187
203
  else
188
204
  arg.to_s
189
205
  end
190
206
  end
191
207
 
192
208
  def anonymous_module_name(mod)
193
- return '#<Module>' unless mod.is_a?(Class)
209
+ return '#<Module>' unless core_is_a?(mod, Class)
210
+
211
+ superclass = CLASS_SUPERCLASS.bind_call(mod)
212
+ superclass = CLASS_SUPERCLASS.bind_call(superclass) while superclass && module_name(superclass).nil?
213
+ superclass ? "#<Class < #{module_name(superclass)}>" : '#<Class>'
214
+ end
215
+
216
+ # `described` is the module's #to_s, which is RSpec's (and so 0.16.1's) name for it,
217
+ # kept unless it has an address in it.
218
+ def module_description(mod, described)
219
+ return described unless MEMORY_ADDRESS.match?(described)
220
+
221
+ name = module_name(mod)
222
+ name.nil? || name.empty? ? anonymous_module_name(mod) : name
223
+ end
194
224
 
195
- superclass = mod.superclass
196
- superclass = superclass.superclass while superclass && superclass.name.nil?
197
- superclass ? "#<Class < #{superclass.name}>" : '#<Class>'
225
+ def module_name(mod)
226
+ core_call(mod, :name)
227
+ end
228
+
229
+ # The arg's own method when it works as core's does, else core's: a class may define
230
+ # .name for something else (private, or taking arguments).
231
+ def core_call(obj, method_name)
232
+ core, type = CORE_METHODS.fetch(method_name)
233
+ value = obj.public_send(method_name)
234
+ value.is_a?(type) ? value : core.bind_call(obj)
235
+ rescue StandardError, NotImplementedError
236
+ core.bind_call(obj)
237
+ end
238
+
239
+ def core_is_a?(obj, type)
240
+ KERNEL_IS_A.bind_call(obj, type)
241
+ rescue TypeError # a BasicObject
242
+ false
198
243
  end
199
244
 
200
245
  # Kernel's method, so an object whose own #method means something else
@@ -267,6 +312,7 @@ module RSpec
267
312
  def quarantine?(example, exception)
268
313
  # A replayed abort failure didn't happen on this attempt, so it can't be quarantined.
269
314
  return false if abort_failure(example).equal?(exception)
315
+ return false if Trunk.disable_quarantining?
270
316
 
271
317
  check_quarantine(example, exception)
272
318
  rescue StandardError => e
@@ -480,10 +526,13 @@ module RSpec
480
526
  add_test_case(notification.example) unless RSpec.configuration.dry_run?
481
527
  end
482
528
 
483
- # trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize)
529
+ # trunk-ignore(rubocop/Metrics/MethodLength,rubocop/Metrics/AbcSize,rubocop/Metrics/CyclomaticComplexity)
484
530
  def close(_notification)
485
531
  return if RSpec.configuration.dry_run?
486
532
 
533
+ if Trunk.disable_quarantining?
534
+ puts Colors.yellow('Note: TRUNK_DISABLE_QUARANTINING is set. Test failures were not quarantined.')
535
+ end
487
536
  if @run.quarantining_disabled?
488
537
  puts Colors.yellow('Note: Quarantining is disabled for this repo. Test failures were not quarantined.')
489
538
  end
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.16.2.pre.beta.4
4
+ version: 0.17.0
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Trunk Technologies, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-27 00:00:00.000000000 Z
11
+ date: 2026-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec-core