Class: Minitest::BacktraceFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/lib/minitest.rb

Overview

The standard backtrace filter for minitest.

See Minitest.backtrace_filter=.

Constant Summary collapse

MT_RE =

:nodoc:

%r%lib/minitest%

Instance Method Summary collapse

Instance Method Details

#filter(bt) ⇒ Object

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



1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/minitest-5.17.0/lib/minitest.rb', line 1035

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