File: shorted_backtrace.rb

package info (click to toggle)
ruby-maxitest 7.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 444 kB
  • sloc: ruby: 1,339; makefile: 7
file content (13 lines) | stat: -rw-r--r-- 316 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true
#
# convert absolute paths in backtrace to relative paths
Minitest::BacktraceFilter.prepend(
  Module.new do
    def filter(*)
      backtrace = super
      pwd = "#{Dir.pwd}/"
      section = pwd.size..-1
      backtrace.map { |b| b.start_with?(pwd) ? b[section] : b }
    end
  end
)