class Minitest::LineReporter
def initialize(*)
def initialize(*) super @failures = [] end
def record(result)
def record(result) if !result.skipped? && !result.passed? @failures << result end end
def report
def report return unless @failures.any? io.puts io.puts "Focus on failing tests:" pwd = Pathname.new(Dir.pwd) bin_rails = File.exist?("bin/rails") @failures.each do |res| result = (res.respond_to?(:source_location) ? res : res.method(res.name)) file, line = result.source_location if file file = Pathname.new(file) file = file.relative_path_from(pwd) if file.absolute? output = "#{bin_rails ? "bin/rails test" : "mtest"} #{file}:#{line}" output = "\e[31m#{output}\e[0m" if $stdout.tty? io.puts output end end end