1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-11 08:33:43 -05:00

feat(test): update test summary report (#14629)

This commit is contained in:
Mark Ladyshau 2022-06-14 20:51:49 +02:00 committed by GitHub
parent e1d488ab88
commit d4f609d8e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 84 additions and 69 deletions

View file

@ -17,7 +17,7 @@ fn no_color() {
assert!(out.contains("success ... ok"));
assert!(out.contains("fail ... FAILED"));
assert!(out.contains("ignored ... ignored"));
assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out"));
assert!(out.contains("FAILED | 1 passed | 1 failed | 1 ignored"));
}
itest!(overloads {

View file

@ -815,10 +815,7 @@ fn test_watch() {
let (mut stdout_lines, mut stderr_lines) = child_lines(&mut child);
assert_eq!(stdout_lines.next().unwrap(), "");
assert_contains!(
stdout_lines.next().unwrap(),
"0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out"
);
assert_contains!(stdout_lines.next().unwrap(), "0 passed | 0 failed");
wait_contains("Test finished", &mut stderr_lines);
let foo_file = t.path().join("foo.js");
@ -912,7 +909,7 @@ fn test_watch() {
assert_contains!(stderr_lines.next().unwrap(), "Restarting");
assert_contains!(stdout_lines.next().unwrap(), "running 1 test");
assert_contains!(stdout_lines.next().unwrap(), "FAILED");
wait_contains("test result", &mut stdout_lines);
wait_for(|m| m.contains("FAILED"), &mut stdout_lines);
stdout_lines.next();
wait_contains("Test finished", &mut stderr_lines);
@ -959,10 +956,7 @@ fn test_watch_doc() {
let (mut stdout_lines, mut stderr_lines) = child_lines(&mut child);
assert_eq!(stdout_lines.next().unwrap(), "");
assert_contains!(
stdout_lines.next().unwrap(),
"0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out"
);
assert_contains!(stdout_lines.next().unwrap(), "0 passed | 0 failed");
wait_contains("Test finished", &mut stderr_lines);
let foo_file = t.path().join("foo.ts");

View file

@ -22,6 +22,6 @@ error: AssertionError: Values are not strictly equal:
Failed assertion => ./compat/test_runner/cjs.js:[WILDCARD]
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 1 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -22,6 +22,6 @@ error: AssertionError: Values are not strictly equal:
Failed assertion => ./compat/test_runner/esm.mjs:[WILDCARD]
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 1 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -1,4 +1,4 @@
running 0 tests from [WILDCARD]
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -1,4 +1,4 @@
running 0 tests from [WILDCARD]
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -22,6 +22,6 @@ It most likely originated from a dangling promise, event/timeout handler or top-
./compat/test_runner/top_level_fail_cjs.js (uncaught error)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -22,6 +22,6 @@ It most likely originated from a dangling promise, event/timeout handler or top-
./compat/test_runner/top_level_fail_esm.mjs (uncaught error)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -17,6 +17,6 @@ error: AggregateError
aggregate => ./test/aggregate_error.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -15,4 +15,4 @@ ffi true ... ok [WILDCARD]
hrtime false ... ok [WILDCARD]
hrtime true ... ok [WILDCARD]
test result: ok. 14 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
ok | 14 passed | 0 failed [WILDCARD]

View file

@ -48,4 +48,4 @@ run => ./test/allow_none.ts:[WILDCARD]
ffi => ./test/allow_none.ts:[WILDCARD]
hrtime => ./test/allow_none.ts:[WILDCARD]
test result: FAILED. 0 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
FAILED | 0 passed | 7 failed [WILDCARD]

View file

@ -1,4 +1,4 @@
running 0 tests from ./test/check_local_by_default.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -4,5 +4,5 @@ test 1 ... ok ([WILDCARD])
test 2 ... ok ([WILDCARD])
test 3 ... ok ([WILDCARD])
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 3 passed | 0 failed ([WILDCARD])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/collect/test.ts
running 0 tests from ./test/collect/test.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/doc_only/mod.ts$2-5.ts
running 0 tests from ./test/doc_only/mod.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -33,6 +33,6 @@ exit(0) => ./test/exit_sanitizer.ts:[WILDCARD]
exit(1) => ./test/exit_sanitizer.ts:[WILDCARD]
exit(2) => ./test/exit_sanitizer.ts:[WILDCARD]
test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 3 failed ([WILDCARD])
error: Test failed

View file

@ -86,6 +86,6 @@ test 7 => ./test/fail.ts:22:6
test 8 => ./test/fail.ts:25:6
test 9 => ./test/fail.ts:28:6
test result: FAILED. 0 passed; 10 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 10 failed ([WILDCARD])
error: Test failed

View file

@ -14,6 +14,6 @@ error: Error
test 1 => ./test/fail_fast.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -20,4 +20,4 @@ error: Error
test 1 => ./test/fail_fast_with_val.ts:[WILDCARD]
test 2 => ./test/fail_fast_with_val.ts:[WILDCARD]
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 2 failed ([WILDCARD])

View file

@ -2,5 +2,5 @@ Check file://[WILDCARD]/test/file_protocol.ts
running 1 test from ./test/file_protocol.ts
test 0 ... ok ([WILDCARD])
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -8,5 +8,5 @@ foo ... ok ([WILDCARD])
running 1 test from ./test/filter/c_test.ts
foo ... ok ([WILDCARD])
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out ([WILDCARD])
ok | 3 passed | 0 failed | 6 filtered out ([WILDCARD])

View file

@ -15,6 +15,6 @@ error: Error: fail
error => ./test/finally_timeout.ts:[WILDCARD]
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 1 passed | 1 failed ([WILDCARD])
error: Test failed

View file

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

View file

@ -2,5 +2,5 @@ Check [WILDCARD]/test/ignore_permissions.ts
running 1 test from ./test/ignore_permissions.ts
ignore ... ignored ([WILDCARD])
test result: ok. 0 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed | 1 ignored ([WILDCARD])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/interval.ts
running 0 tests from ./test/interval.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -2,5 +2,5 @@ Check [WILDCARD]/test/load_unload.ts
running 1 test from ./test/load_unload.ts
test ... ok ([WILDCARD])
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -3,5 +3,5 @@ import.meta.main: false
import.meta.url: [WILDCARD]/test/meta.ts
running 0 tests from ./test/meta.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -14,6 +14,6 @@ It most likely originated from a dangling promise, event/timeout handler or top-
./test/no_check.ts (uncaught error)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -11,6 +11,6 @@ error: PermissionDenied: Requires read access to "./some_file.txt", run again wi
no prompt => ./test/no_prompt_by_default.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms)
FAILED | 0 passed | 1 failed ([WILDCARD]ms)
error: Test failed

View file

@ -11,6 +11,6 @@ error: PermissionDenied: Requires read access to "./some_file.txt", run again wi
no prompt => ./test/no_prompt_with_denied_perms.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms)
FAILED | 0 passed | 1 failed ([WILDCARD]ms)
error: Test failed

View file

@ -35,6 +35,6 @@ qux => [WILDCARD]/non_error_thrown.ts:13:6
quux => [WILDCARD]/non_error_thrown.ts:17:6
quuz => [WILDCARD]/non_error_thrown.ts:21:6
test result: FAILED. 0 passed; 6 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 6 failed ([WILDCARD])
error: Test failed

View file

@ -2,6 +2,6 @@ Check [WILDCARD]/test/only.ts
running 1 test from ./test/only.ts
only ... ok ([WILDCARD])
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 2 filtered out ([WILDCARD])
ok | 1 passed | 0 failed | 2 filtered out ([WILDCARD])
error: Test failed because the "only" option was used

View file

@ -16,6 +16,6 @@ To get more details where ops were leaked, run again with --trace-ops flag.
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
FAILED | 0 passed | 1 failed [WILDCARD]
error: Test failed

View file

@ -46,6 +46,6 @@ error: AssertionError: Test case is leaking async ops.
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 2 failed ([WILDCARD])
error: Test failed

View file

@ -26,6 +26,6 @@ To get more details where ops were leaked, run again with --trace-ops flag.
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 2 failed ([WILDCARD])
error: Test failed

View file

@ -3,5 +3,5 @@ running 2 tests from ./test/ops_sanitizer_nexttick.ts
test 1 ... ok ([WILDCARD])
test 2 ... ok ([WILDCARD])
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 2 passed | 0 failed ([WILDCARD])

View file

@ -2,5 +2,5 @@ Check [WILDCARD]/testdata/test/ops_sanitizer_timeout_failure.ts
running 1 test from ./test/ops_sanitizer_timeout_failure.ts
wait ... ok ([WILDCARD])
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -20,6 +20,6 @@ error: AssertionError: Test case is leaking async ops.
leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 1 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -7,5 +7,5 @@ test3 ... ok ([WILDCARD])
test4 ... ok ([WILDCARD])
test5 ... ignored ([WILDCARD])
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 5 passed | 0 failed | 1 ignored ([WILDCARD])

View file

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

View file

@ -4,5 +4,5 @@ console.error ... ok ([WILDCARD])
console.info ... ok ([WILDCARD])
console.warn ... ok ([WILDCARD])
test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 4 passed | 0 failed ([WILDCARD])

View file

@ -16,6 +16,6 @@ error: AssertionError: Test case is leaking 2 resources:
leak => ./test/resource_sanitizer.ts:[WILDCARD]
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -35,5 +35,5 @@ test 4 ... ok ([WILDCARD])
test 1 ... ok ([WILDCARD])
test 0 ... ok ([WILDCARD])
test result: ok. 30 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 30 passed | 0 failed ([WILDCARD])

View file

@ -57,6 +57,6 @@ nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]
failing step in failing test => ./test/steps/failing_steps.ts:[WILDCARD]
test result: FAILED. 0 passed (1 step); 3 failed (5 steps); 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed (1 step) | 3 failed (5 steps) ([WILDCARD])
error: Test failed

View file

@ -5,4 +5,4 @@ ignored step ...
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
test result: ok. 1 passed (1 step); 0 failed; 0 ignored (1 step); 0 measured; 0 filtered out [WILDCARD]
ok | 1 passed (1 step) | 0 failed | 0 ignored (1 step) [WILDCARD]

View file

@ -109,6 +109,6 @@ parallel steps when first has sanitizer => ./test/steps/invalid_usage.ts:[WILDCA
parallel steps when second has sanitizer => ./test/steps/invalid_usage.ts:[WILDCARD]
parallel steps where only inner tests have sanitizers => ./test/steps/invalid_usage.ts:[WILDCARD]
test result: FAILED. 0 passed (4 steps); 7 failed (10 steps); 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed (4 steps) | 7 failed (10 steps) ([WILDCARD])
error: Test failed

View file

@ -35,4 +35,4 @@ steps buffered then streaming reporting ...
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
test result: ok. 5 passed (18 steps); 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
ok | 5 passed (18 steps) | 0 failed [WILDCARD]

View file

@ -1,4 +1,4 @@
running 0 tests from ./test/text.md
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])

View file

@ -53,6 +53,6 @@ bar 2 => ./test/uncaught_errors_2.ts:3:6
bar 3 => ./test/uncaught_errors_2.ts:6:6
./test/uncaught_errors_3.ts (uncaught error)
test result: FAILED. 2 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 2 passed | 5 failed ([WILDCARD])
error: Test failed

View file

@ -17,6 +17,6 @@ It most likely originated from a dangling promise, event/timeout handler or top-
./test/unhandled_rejection.ts (uncaught error)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
FAILED | 0 passed | 1 failed ([WILDCARD])
error: Test failed

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/unresolved_promise.ts
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | 0 passed | 0 failed ([WILDCARD])
error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises.

View file

@ -1,3 +1,3 @@
[WILDCARD]
test result: ok. [WILDCARD] passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
ok | [WILDCARD] passed | 0 failed ([WILDCARD])

View file

@ -617,19 +617,40 @@ impl TestReporter for PrettyTestReporter {
format!(" ({} steps)", count)
}
};
println!(
"\ntest result: {}. {} passed{}; {} failed{}; {} ignored{}; {} measured; {} filtered out {}\n",
status,
let mut summary_result = String::new();
summary_result.push_str(&format!(
"{} passed{} | {} failed{}",
summary.passed,
get_steps_text(summary.passed_steps),
summary.failed,
get_steps_text(summary.failed_steps + summary.pending_steps),
summary.ignored,
get_steps_text(summary.ignored_steps),
summary.measured,
summary.filtered_out,
colors::gray(
format!("({})", display::human_elapsed(elapsed.as_millis()))),
));
let ignored_steps = get_steps_text(summary.ignored_steps);
if summary.ignored > 0 || !ignored_steps.is_empty() {
summary_result
.push_str(&format!(" | {} ignored{}", summary.ignored, ignored_steps))
};
if summary.measured > 0 {
summary_result.push_str(&format!(" | {} measured", summary.measured,))
};
if summary.filtered_out > 0 {
summary_result
.push_str(&format!(" | {} filtered out", summary.filtered_out,))
};
println!(
"\n{} | {} {}\n",
status,
summary_result,
colors::gray(format!(
"({})",
display::human_elapsed(elapsed.as_millis())
)),
);
self.in_new_line = true;
}