123456789_123456789_123456789_123456789_123456789_

Class: Minitest::BacktraceFilter

Relationships & Source Files
Inherits: Object
Defined in: lib/minitest.rb

Overview

The standard backtrace filter for minitest.

See Minitest.backtrace_filter=.

Instance Method Summary

Instance Method Details

#filter(bt)

Filter bt to something useful. Returns the whole thing if $DEBUG (ruby) or $MT_DEBUG (env).

[ GitHub ]

  
# File 'lib/minitest.rb', line 1013

def filter bt
  return ["No backtrace"] unless bt

  return bt.dup if $DEBUG || ENV["MT_DEBUG"]

  new_bt = bt.take_while { |line| line !~ MT_RE }
  new_bt = bt.select     { |line| line !~ MT_RE } if new_bt.empty?
  new_bt = bt.dup                                 if new_bt.empty?

  new_bt
end