From e06bd19a695a515fe2a2b52495048ad82c26e6d4 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Mon, 27 Mar 2023 01:10:47 +0200 Subject: [PATCH] fix(cli): add colors to "Module not found" error frame (#18437) --- cli/graph_util.rs | 7 ++++++- cli/tools/vendor/build.rs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cli/graph_util.rs b/cli/graph_util.rs index 6c38dccadc..5dc7d17d64 100644 --- a/cli/graph_util.rs +++ b/cli/graph_util.rs @@ -96,7 +96,12 @@ pub fn graph_valid( if let Some(range) = error.maybe_range() { if !is_root && !range.specifier.as_str().contains("/$deno$eval") { - message.push_str(&format!("\n at {range}")); + message.push_str(&format!( + "\n at {}:{}:{}", + colors::cyan(range.specifier.as_str()), + colors::yellow(&(range.start.line + 1).to_string()), + colors::yellow(&(range.start.character + 1).to_string()) + )); } } diff --git a/cli/tools/vendor/build.rs b/cli/tools/vendor/build.rs index 3bee843fd6..f9df8f0786 100644 --- a/cli/tools/vendor/build.rs +++ b/cli/tools/vendor/build.rs @@ -1117,7 +1117,7 @@ mod test { .unwrap(); assert_eq!( - err.to_string(), + test_util::strip_ansi_codes(&err.to_string()), concat!( "500 Internal Server Error\n", " at https://localhost/mod.ts:1:14"