mirror of
https://github.com/discourse/discourse.git
synced 2025-01-30 06:28:03 +08:00
DEV: Add RSPEC_EXCLUDE_NOISE_IN_BACKTRACE for rspec (#28160)
Sometimes the backtrace is quite big for failing specs, this env var (RSPEC_EXCLUDE_NOISE_IN_BACKTRACE) can be set to 1 to remove backtrace from anything but spec or application code in rspec. This makes it easier to see where the actual failure is coming from, most of the time all the gem paths are noise.
This commit is contained in:
parent
46b296527b
commit
a47bcfc2f3
|
@ -239,7 +239,22 @@ RSpec.configure do |config|
|
|||
# rspec-rails.
|
||||
config.infer_base_class_for_anonymous_controllers = true
|
||||
|
||||
config.full_cause_backtrace = true
|
||||
# Shows more than one line of backtrace in case of an error or spec failure.
|
||||
config.full_cause_backtrace = false
|
||||
|
||||
# Sometimes the backtrace is quite big for failing specs, this will
|
||||
# remove rspec/gem paths from the backtrace so it's easier to see the
|
||||
# actual application code that caused the failure.
|
||||
if ENV["RSPEC_EXCLUDE_NOISE_IN_BACKTRACE"]
|
||||
config.backtrace_exclusion_patterns = [
|
||||
%r{/lib\d*/ruby/},
|
||||
%r{bin/},
|
||||
/gems/,
|
||||
%r{spec/spec_helper\.rb},
|
||||
%r{spec/rails_helper\.rb},
|
||||
%r{lib/rspec/(core|expectations|matchers|mocks)},
|
||||
]
|
||||
end
|
||||
|
||||
config.before(:suite) do
|
||||
CachedCounting.disable
|
||||
|
|
Loading…
Reference in New Issue
Block a user