0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

feat(test): repeat test name if there's user output (#14495)

This commit changes test report output to repeat test name
before printing result, but only if there's user output, denoted
by markers.
This commit is contained in:
Bartek Iwańczuk 2022-05-09 13:25:04 +02:00 committed by GitHub
parent 23efc4fcab
commit d4ad2b809c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 5 deletions

View file

@ -9,6 +9,11 @@ test 5 ... ok ([WILDCARD])
test 6 ... ok ([WILDCARD])
test 7 ... ok ([WILDCARD])
test 8 ... ok ([WILDCARD])
test 9 ...
------- output -------
console.log
console.error
----- output end -----
test 9 ... ok ([WILDCARD])
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -7,4 +7,7 @@ Deno.test("test 5", () => {});
Deno.test("test 6", () => {});
Deno.test("test 7", () => {});
Deno.test("test 8", () => {});
Deno.test("test 9", () => {});
Deno.test("test 9", () => {
console.log("console.log");
console.error("console.error");
});

View file

@ -12,20 +12,20 @@ description ...
------- output -------
3
----- output end -----
ok ([WILDCARD]ms)
inner 1 ... ok ([WILDCARD]ms)
inner 2 ...
------- output -------
4
----- output end -----
ok ([WILDCARD]ms)
inner 2 ... ok ([WILDCARD]ms)
------- output -------
5
----- output end -----
ok ([WILDCARD]ms)
step 1 ... ok ([WILDCARD]ms)
------- output -------
6
----- output end -----
ok ([WILDCARD]ms)
description ... ok ([WILDCARD]ms)
[WILDCARD]

View file

@ -312,6 +312,10 @@ impl PrettyTestReporter {
print!("{}", " ".repeat(description.level));
}
if wrote_user_output {
print!("{} ... ", description.name);
}
println!(
"{} {}",
status,
@ -414,6 +418,10 @@ impl TestReporter for PrettyTestReporter {
print!(" ");
}
if wrote_user_output {
print!("{} ... ", description.name);
}
let status = match result {
TestResult::Ok => colors::green("ok").to_string(),
TestResult::Ignored => colors::yellow("ignored").to_string(),