How to show longer traces in Rails TestCases
See whether you haven't a file config/initializers/backtrace_silencers.rb
It says:
# You can also remove all the silencers if you're trying to debug# a problem that might stem from framework code.Rails.backtrace_cleaner.remove_silencers!
You can also call remove_filters!
if the first was not enough, but filters only make the paths shorter, while silencers do remove some lines from the backtrace.
You may find the source code in railties/lib/rails/backtrace_cleaner.rb
and activesupport/lib/active_support/backtrace_cleaner.rb
useful.
You can customize Minitest stack traces like this for example:
class MyBacktraceFilter def filter bt bt.dup.reject{|x| not x.to_s =~ /#{::Rails.root.to_s}/} endendMiniTest.backtrace_filter = MyBacktraceFilter.new
The filter method accepts the full stack trace in the bt
parameter as an array and returns the filtered array. If you want the entire stack to show simply pass the input:
class MyBacktraceFilter def filter bt bt endendMiniTest.backtrace_filter = MyBacktraceFilter.new
You could try setting global variable $DEBUG to non-nil value. If that's minitest who filters your backtrace, setting $DEBUG = true
would ensure that the entire backtrace is printed out.