Skip to content

Commit

Permalink
Dim external frames
Browse files Browse the repository at this point in the history
  • Loading branch information
icy-arctic-fox committed Aug 5, 2024
1 parent ba90a0c commit bb9bf14
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/spectator/formatters/common_text_output.cr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:")
Expand Down

0 comments on commit bb9bf14

Please sign in to comment.