rspec-core 3.12.3 → 3.13.0

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: 65faca56212d43553a89222b29304722e36f0b0dfb92e8b6334f4d1a872450b7
4
- data.tar.gz: d9c419a1a81321f14b36b2701927831fac99f1146a711afeea363d03e25c4e45
3
+ metadata.gz: 74e1ccff0acb0f5e68bb6ed4c4552b0313d28e348f414d37e09b5741321c6153
4
+ data.tar.gz: 017cac1b0c789c1a75dc9bb782a415608284ef2e9fcaba87087e5745040abeb2
5
5
  SHA512:
6
- metadata.gz: 2bb18f48624fb39f57b49f7109a2fd1d1cda6d96a38c2301ffb04255cab661306b4d877e01883d7ea4c45908fc6a6529b67d9daaf9dec7abf6e86941f73a2b2b
7
- data.tar.gz: be8dd6eaf89cc40b217b753b51c4e688ecd9904d4031d5c4934f68bdd8d2bb67377b36076cb5b852845ee233a455a9da68c585c26513b8bba89189dd34347469
6
+ metadata.gz: e16148576b7e0405cf5de89771fc303a7ae20166250f5d29b5c651bc5a7757a7da183081eccf762050cc85b2e8f2618d7a4104f5957da9e5d6709b17b780d81a
7
+ data.tar.gz: e8a969ee3e5154e6873a5b180ae71a24cc0ae5c62cf5c2642fafab7be5814c2e37987256cbf908421ee1eacfd0ebe0476f254108845df2cdc921cf2fbebd3741
checksums.yaml.gz.sig CHANGED
Binary file
data/Changelog.md CHANGED
@@ -1,6 +1,23 @@
1
1
  ### Development
2
2
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.3...main)
3
3
 
4
+ ### 3.13.0 / 2024-02-04
5
+ [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.3...v3.13.0)
6
+
7
+ Enhancements:
8
+
9
+ * Support the `--backtrace` flag when using the JSON formatter. (Matt Larraz, #2980)
10
+ * Ignore commented out lines in CLI config files (e.g. `.rspec`). (Junichi Ito, #2984)
11
+ * Add `pending_failure_output` config option to allow skipping backtraces or
12
+ muting pending specs output. (Phil Pirozhkov, #2957)
13
+ * Process `--dry-run` before configuration flags that read files so that introspecting
14
+ it returns the correct value. (Xenor Chang, #3008)
15
+ * Allow specifying custom ordering strategies via `--order`. (Jon Rowe, #3025)
16
+ * Use the improved `syntax_suggest` output for `SyntaxError` when available.
17
+ (Richard Schneeman, #3015, #3026)
18
+ * Add config option (`RSpec::Core::Configuration#full_cause_backtrace`) to print the
19
+ entire backtrace of an exception cause. (David Taylor, #3046)
20
+
4
21
  ### 3.12.3 / 2024-02-04
5
22
  [Full Changelog](http://github.com/rspec/rspec-core/compare/v3.12.2...v3.12.3)
6
23
 
@@ -458,6 +458,25 @@ module RSpec
458
458
  # return [Integer]
459
459
  add_setting :max_displayed_failure_line_count
460
460
 
461
+ # @macro full_cause_backtrace
462
+ # Display the full backtrace of an exceptions cause (defaults to `false`).
463
+ # return [Boolean]
464
+ add_setting :full_cause_backtrace
465
+
466
+ # @macro add_setting
467
+ # Format the output for pending examples. Can be set to:
468
+ # - :full (default) - pending examples appear similarly to failures
469
+ # - :no_backtrace - same as above, but with no backtrace
470
+ # - :skip - do not show the section at all
471
+ # return [Symbol]
472
+ add_read_only_setting :pending_failure_output
473
+ def pending_failure_output=(mode)
474
+ raise ArgumentError,
475
+ "`pending_failure_output` can be set to :full, :no_backtrace, " \
476
+ "or :skip" unless [:full, :no_backtrace, :skip].include?(mode)
477
+ @pending_failure_output = mode
478
+ end
479
+
461
480
  # Determines which bisect runner implementation gets used to run subsets
462
481
  # of the suite during a bisection. Your choices are:
463
482
  #
@@ -557,8 +576,10 @@ module RSpec
557
576
  @derived_metadata_blocks = FilterableItemRepository::QueryOptimized.new(:any?)
558
577
  @threadsafe = true
559
578
  @max_displayed_failure_line_count = 10
579
+ @full_cause_backtrace = false
560
580
  @world = World::Null
561
581
  @shared_context_metadata_behavior = :trigger_inclusion
582
+ @pending_failure_output = :full
562
583
 
563
584
  define_built_in_hooks
564
585
  end
@@ -2120,6 +2141,13 @@ module RSpec
2120
2141
  suggestions = DidYouMean.new(relative_file).call
2121
2142
  reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.#{suggestions}")
2122
2143
  RSpec.world.wants_to_quit = true
2144
+ rescue SyntaxError => ex
2145
+ relative_file = Metadata.relative_path(file)
2146
+ reporter.notify_non_example_exception(
2147
+ ex,
2148
+ "While loading #{relative_file} a `raise SyntaxError` occurred, RSpec will now quit."
2149
+ )
2150
+ RSpec.world.rspec_is_quitting = true
2123
2151
  rescue Support::AllExceptionsExceptOnesWeMustNotRescue => ex
2124
2152
  relative_file = Metadata.relative_path(file)
2125
2153
  reporter.notify_non_example_exception(ex, "An error occurred while loading #{relative_file}.")
@@ -79,6 +79,10 @@ module RSpec
79
79
  # deprecation (or otherwise access the reporter).
80
80
  :deprecation_stream,
81
81
 
82
+ # In order for `RSpec.configuration.dry_run?` to return `true` during
83
+ # processing the `requires` option, it must be parsed before it.
84
+ :dry_run,
85
+
82
86
  # load paths depend on nothing, but must be set before `requires`
83
87
  # to support load-path-relative requires.
84
88
  :libs,
@@ -169,7 +173,8 @@ module RSpec
169
173
  def args_from_options_file(path)
170
174
  return [] unless path && File.exist?(path)
171
175
  config_string = options_file_as_erb_string(path)
172
- FlatMap.flat_map(config_string.split(/\n+/), &:shellsplit)
176
+ config_lines = config_string.split(/\n+/).reject { |s| s =~ /\A\s*#/ }
177
+ FlatMap.flat_map(config_lines, &:shellsplit)
173
178
  end
174
179
 
175
180
  def options_file_as_erb_string(path)
@@ -56,7 +56,12 @@ module RSpec
56
56
  end
57
57
 
58
58
  unless last_cause.backtrace.nil? || last_cause.backtrace.empty?
59
- cause << (" #{backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata).first}")
59
+ lines = backtrace_formatter.format_backtrace(last_cause.backtrace, example.metadata)
60
+ lines = [lines[0]] unless RSpec.configuration.full_cause_backtrace # rubocop:disable Metrics/BlockNesting
61
+
62
+ lines.each do |line|
63
+ cause << (" #{line}")
64
+ end
60
65
  end
61
66
  end
62
67
 
@@ -175,10 +180,22 @@ module RSpec
175
180
  end
176
181
 
177
182
  # rubocop:disable Lint/RescueException
178
- def exception_message_string(exception)
179
- exception.message.to_s
180
- rescue Exception => other
181
- "A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
183
+ if SyntaxError.instance_methods.include?(:detailed_message)
184
+ def exception_message_string(exception)
185
+ case exception
186
+ when SyntaxError then exception.detailed_message.to_s
187
+ else
188
+ exception.message.to_s
189
+ end
190
+ rescue Exception => other
191
+ "A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
192
+ end
193
+ else
194
+ def exception_message_string(exception)
195
+ exception.message.to_s
196
+ rescue Exception => other
197
+ "A #{exception.class} for which `exception.message.to_s` raises #{other.class}."
198
+ end
182
199
  end
183
200
  # rubocop:enable Lint/RescueException
184
201
 
@@ -312,10 +329,14 @@ module RSpec
312
329
  ]
313
330
  }
314
331
  elsif @execution_result.status == :pending
315
- {
332
+ options = {
316
333
  :message_color => RSpec.configuration.pending_color,
317
334
  :detail_formatter => PENDING_DETAIL_FORMATTER
318
335
  }
336
+ if RSpec.configuration.pending_failure_output == :no_backtrace
337
+ options[:backtrace_formatter] = EmptyBacktraceFormatter
338
+ end
339
+ options
319
340
  end
320
341
  end
321
342
 
@@ -32,15 +32,16 @@ module RSpec
32
32
  @output_hash[:summary_line] = summary.totals_line
33
33
  end
34
34
 
35
- def stop(notification)
36
- @output_hash[:examples] = notification.examples.map do |example|
37
- format_example(example).tap do |hash|
38
- e = example.exception
35
+ def stop(group_notification)
36
+ @output_hash[:examples] = group_notification.notifications.map do |notification|
37
+ format_example(notification.example).tap do |hash|
38
+ e = notification.example.exception
39
+
39
40
  if e
40
- hash[:exception] = {
41
+ hash[:exception] = {
41
42
  :class => e.class.name,
42
43
  :message => e.message,
43
- :backtrace => e.backtrace,
44
+ :backtrace => notification.formatted_backtrace,
44
45
  }
45
46
  end
46
47
  end
@@ -120,6 +120,8 @@ module RSpec::Core
120
120
  # @return [String] The list of pending examples, fully formatted in the
121
121
  # way that RSpec's built-in formatters emit.
122
122
  def fully_formatted_pending_examples(colorizer=::RSpec::Core::Formatters::ConsoleCodes)
123
+ return if RSpec.configuration.pending_failure_output == :skip
124
+
123
125
  formatted = "\nPending: (Failures listed here are expected and do not affect your suite's status)\n".dup
124
126
 
125
127
  pending_notifications.each_with_index do |notification, index|
@@ -78,6 +78,30 @@ module RSpec
78
78
  end
79
79
  end
80
80
 
81
+ # @private
82
+ # A strategy which delays looking up the ordering until needed
83
+ class Delayed
84
+ def initialize(registry, name)
85
+ @registry = registry
86
+ @name = name
87
+ end
88
+
89
+ def order(list)
90
+ strategy.order(list)
91
+ end
92
+
93
+ private
94
+
95
+ def strategy
96
+ @strategy ||= lookup_strategy
97
+ end
98
+
99
+ def lookup_strategy
100
+ raise "Undefined ordering strategy #{@name.inspect}" unless @registry.has_strategy?(@name)
101
+ @registry.fetch(@name)
102
+ end
103
+ end
104
+
81
105
  # @private
82
106
  # Stores the different ordering strategies.
83
107
  class Registry
@@ -99,6 +123,10 @@ module RSpec
99
123
  @strategies.fetch(name, &fallback)
100
124
  end
101
125
 
126
+ def has_strategy?(name)
127
+ @strategies.key?(name)
128
+ end
129
+
102
130
  def register(sym, strategy)
103
131
  @strategies[sym] = strategy
104
132
  end
@@ -143,9 +171,20 @@ module RSpec
143
171
  :defined
144
172
  elsif order == 'recently-modified'
145
173
  :recently_modified
174
+ else
175
+ order.to_sym
146
176
  end
147
177
 
148
- register_ordering(:global, ordering_registry.fetch(ordering_name)) if ordering_name
178
+ if ordering_name
179
+ strategy =
180
+ if ordering_registry.has_strategy?(ordering_name)
181
+ ordering_registry.fetch(ordering_name)
182
+ else
183
+ Delayed.new(ordering_registry, ordering_name)
184
+ end
185
+
186
+ register_ordering(:global, strategy)
187
+ end
149
188
  end
150
189
 
151
190
  def force(hash)
@@ -3,7 +3,7 @@ module RSpec
3
3
  # Version information for RSpec Core.
4
4
  module Version
5
5
  # Current version of RSpec Core, in semantic versioning format.
6
- STRING = '3.12.3'
6
+ STRING = '3.13.0'
7
7
  end
8
8
  end
9
9
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.3
4
+ version: 3.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Baker
@@ -54,14 +54,14 @@ dependencies:
54
54
  requirements:
55
55
  - - "~>"
56
56
  - !ruby/object:Gem::Version
57
- version: 3.12.0
57
+ version: 3.13.0
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 3.12.0
64
+ version: 3.13.0
65
65
  - !ruby/object:Gem::Dependency
66
66
  name: cucumber
67
67
  requirement: !ruby/object:Gem::Requirement
@@ -267,7 +267,7 @@ licenses:
267
267
  - MIT
268
268
  metadata:
269
269
  bug_tracker_uri: https://github.com/rspec/rspec-core/issues
270
- changelog_uri: https://github.com/rspec/rspec-core/blob/v3.12.3/Changelog.md
270
+ changelog_uri: https://github.com/rspec/rspec-core/blob/v3.13.0/Changelog.md
271
271
  documentation_uri: https://rspec.info/documentation/
272
272
  mailing_list_uri: https://groups.google.com/forum/#!forum/rspec
273
273
  source_code_uri: https://github.com/rspec/rspec-core
@@ -290,5 +290,5 @@ requirements: []
290
290
  rubygems_version: 3.4.10
291
291
  signing_key:
292
292
  specification_version: 4
293
- summary: rspec-core-3.12.3
293
+ summary: rspec-core-3.13.0
294
294
  test_files: []
metadata.gz.sig CHANGED
@@ -1 +1,4 @@
1
- ������ҽ���c��2�����|���]��fsO�~�+��;�9�9�2��r�;UT�#%�0@��,OoR.$�Kh'��7���z||�+�A^��j����h�� {�� ޖp�c���6sO
1
+ MZ�EO��RS·1��qALT`��`�� ���5˾B\$�^�:��4��D7�PӇ.�m'�����ޛM.�֔Ŋ#�eّ�&2���'�I� 5���,P\�q���W�����v�Z,5p^���( n�o��W��(���?lΰ[��N-��@}Q�)������k X����σ�������+�w��M���^E`3���.�Z��vs��(��ZL �#�����Ay8͔�ho� 7����U�T#8���\��1�����Xs�K��N��v7u>�X��_��tܿ�X���8��61e�|�+:�<�JvQɯ�����Q��ed�����I3˦i�� L*12��
2
+ qQ���wbs��E:r�dz;�Թ
3
+ ���oM�F/�� #���᤯��)���Q��
4
+ ��h�F(A�[{ִ��P�Dž����5���f��a�㼘|A9��2���%�Q��~�a�����y���Z���W�mH|���6h�=�Ӳ�_�