diff --git a/src/spectator/formatters/common_text_output.cr b/src/spectator/formatters/common_text_output.cr index 66cb7cff..3a0edb52 100644 --- a/src/spectator/formatters/common_text_output.cr +++ b/src/spectator/formatters/common_text_output.cr @@ -91,10 +91,9 @@ module Spectator::Formatters private def print_trace(error) : Nil printer.print_label(:error, &.<< "#{error.class}: ") printer.puts "#{error.message}" - printer.puts error.backtrace?.try &.each do |frame| - printer << " from " + frame = frame.colorize.dim if external_frame?(frame) printer.puts frame end @@ -103,6 +102,13 @@ module Spectator::Formatters end end + private def external_frame?(frame : String) + frame.starts_with?("lib/") || # Crystal shards + frame.starts_with?('/') || # POSIX absolute path + frame.starts_with?(/^\w+:/) || # Windows absolute path + frame == "???" + end + private def report_skipped(results : Enumerable(Core::ExecutionResult)) : Nil printer.puts printer.print_title(:warning, &.<< "Skipped:")