fix(cli): add colors to "Module not found" error frame (#18437)

This commit is contained in:
Marvin Hagemeister 2023-03-27 01:10:47 +02:00 committed by GitHub
parent a29d88b43b
commit 355275ec0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -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())
));
}
}

View file

@ -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"