Turn on full backtrace in Ruby on Rails TestCase

BACKTRACE=blegga rake test

BACKTRACE=blegga rails test # rails 5+

Append --trace if you need rake related log.


Finally figured this out. The issue is with the 'turn' gem included in Rails 3.1, or actually with turn v0.8.2, which is required by the default Gemfile:

group :test do
  # Pretty printed test output
  gem 'turn', '0.8.2', require: false
end

Turn v0.8.2 doesn't include the full backtrace, so you have to upgrade to get it. I did that by changing the above in my Gemfile to this:

group :test do
  # Pretty printed test output
  gem 'turn', require: false
  gem 'minitest'
end

(I had to add minitest because otherwise turn throws a RuntimeError saying "MiniTest v1.6.0 is out of date.")

Then I ran bundle update turn and got the latest verion (0.9.2 as of this writing). That gives full backtraces.


Nowdays you can run:

rails test --backtrace