lib/turn/reporter.rb in turn-0.9.3 vs lib/turn/reporter.rb in turn-0.9.4
- old
+ new
@@ -70,31 +70,34 @@
# Apply filter_backtrace and limit_backtrace in one go.
def clean_backtrace(backtrace)
limit_backtrace(filter_backtrace(backtrace))
end
+ # TODO: Is the text/unit line needed any more now that Dir.pwd is excluded
+ # from filtering?
+
$RUBY_IGNORE_CALLERS ||= []
$RUBY_IGNORE_CALLERS.concat([
/\/lib\/turn.*\.rb/,
/\/bin\/turn/,
/\/lib\/minitest.*\.rb/,
- /\/test\/unit.*\.rb/
+ /\/test\/unit(?!(\/.*\_test.rb)|.*\/test_.*).*\.rb.*/
])
# Filter backtrace of unimportant entries, and applies count limit if set in
# configuration. Setting $DEBUG to true will deactivate filter, or if the filter
# happens to remove all backtrace entries it will revert to the full backtrace,
# as that probably means there was an issue with the test harness itself.
def filter_backtrace(backtrace)
return [] unless backtrace
- bt = backtrace.dup
- bt = bt.reject{ |line| $RUBY_IGNORE_CALLERS.any?{ |re| re =~ line } } unless $DEBUG
- #bt.reject!{ |line| line.rindex('minitest') }
- #bt.reject!{ |line| line.rindex('test/unit') }
- #bt.reject!{ |line| line.rindex('lib/turn') }
- #bt.reject!{ |line| line.rindex('bin/turn') }
+ bt, pwd = backtrace.dup, Dir.pwd
+ unless $DEBUG
+ bt = bt.reject do |line|
+ $RUBY_IGNORE_CALLERS.any?{|re| re =~ line} unless line.start_with?(pwd)
+ end
+ end
bt = backtrace if bt.empty? # if empty just dump the whole thing
- bt.map{ |line| line.sub(Dir.pwd+'/', '') }
+ bt.map{ |line| line.sub(pwd+'/', '') }
end
# Limit backtrace to number of lines if `trace` configuration option is set.
def limit_backtrace(backtrace)
return [] unless backtrace