1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-23 15:49:44 -05:00

feat(test): change "failures:" headers in test report (#14490)

This commit is contained in:
Bartek Iwańczuk 2022-05-09 10:56:13 +02:00 committed by GitHub
parent d0f5cd6a06
commit ab728e9ccf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 47 additions and 38 deletions

View file

@ -2,7 +2,7 @@ running 2 tests from ./compat/test_runner/cjs.js
Correct assertion ... ok ([WILDCARD])
Failed assertion ... FAILED ([WILDCARD])
failures:
ERRORS
Failed assertion => ./compat/test_runner/cjs.js:[WILDCARD]
error: AssertionError: Values are not strictly equal:
@ -18,7 +18,7 @@ error: AssertionError: Values are not strictly equal:
^
[WILDCARD]
failures:
FAILURES
Failed assertion => ./compat/test_runner/cjs.js:[WILDCARD]

View file

@ -2,7 +2,7 @@ running 2 tests from ./compat/test_runner/esm.mjs
Correct assertion ... ok ([WILDCARD])
Failed assertion ... FAILED ([WILDCARD])
failures:
ERRORS
Failed assertion => ./compat/test_runner/esm.mjs:[WILDCARD]
error: AssertionError: Values are not strictly equal:
@ -18,7 +18,7 @@ error: AssertionError: Values are not strictly equal:
^
[WILDCARD]
failures:
FAILURES
Failed assertion => ./compat/test_runner/esm.mjs:[WILDCARD]

View file

@ -1,7 +1,7 @@
running 1 test from ./test/aggregate_error.ts
aggregate ... FAILED ([WILDCARD])
failures:
ERRORS
aggregate => ./test/aggregate_error.ts:[WILDCARD]
error: AggregateError
@ -13,7 +13,7 @@ error: AggregateError
^
at [WILDCARD]/testdata/test/aggregate_error.ts:5:9
failures:
FAILURES
aggregate => ./test/aggregate_error.ts:[WILDCARD]

View file

@ -8,7 +8,7 @@ run ... FAILED [WILDCARD]
ffi ... FAILED [WILDCARD]
hrtime ... FAILED [WILDCARD]
failures:
ERRORS
read => ./test/allow_none.ts:[WILDCARD]
error: PermissionDenied: Can't escalate parent thread permissions
@ -38,7 +38,7 @@ hrtime => ./test/allow_none.ts:[WILDCARD]
error: PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
failures:
FAILURES
read => ./test/allow_none.ts:[WILDCARD]
write => ./test/allow_none.ts:[WILDCARD]

View file

@ -4,7 +4,7 @@ exit(0) ... FAILED ([WILDCARD])
exit(1) ... FAILED ([WILDCARD])
exit(2) ... FAILED ([WILDCARD])
failures:
ERRORS
exit(0) => ./test/exit_sanitizer.ts:[WILDCARD]
error: AssertionError: Test case attempted to exit with exit code: 0
@ -27,7 +27,7 @@ error: AssertionError: Test case attempted to exit with exit code: 2
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:10:8
failures:
FAILURES
exit(0) => ./test/exit_sanitizer.ts:[WILDCARD]
exit(1) => ./test/exit_sanitizer.ts:[WILDCARD]

View file

@ -11,7 +11,7 @@ test 7 ... FAILED ([WILDCARD])
test 8 ... FAILED ([WILDCARD])
test 9 ... FAILED ([WILDCARD])
failures:
ERRORS
test 0 => ./test/fail.ts:1:6
error: Error
@ -73,7 +73,7 @@ error: Error
^
at [WILDCARD]/test/fail.ts:29:9
failures:
FAILURES
test 0 => ./test/fail.ts:1:6
test 1 => ./test/fail.ts:4:6

View file

@ -2,7 +2,7 @@ Check [WILDCARD]/test/fail_fast.ts
running 10 tests from ./test/fail_fast.ts
test 1 ... FAILED ([WILDCARD])
failures:
ERRORS
test 1 => ./test/fail_fast.ts:[WILDCARD]
error: Error
@ -10,7 +10,7 @@ error: Error
^
at [WILDCARD]/test/fail_fast.ts:2:9
failures:
FAILURES
test 1 => ./test/fail_fast.ts:[WILDCARD]

View file

@ -3,7 +3,7 @@ running 10 tests from [WILDCARD]/test/fail_fast_with_val.ts
test test 1 ... FAILED ([WILDCARD])
test test 2 ... FAILED ([WILDCARD])
failures:
ERRORS
test 1 => ./test/fail_fast_with_val.ts:[WILDCARD]
error: Error
@ -15,7 +15,7 @@ error: Error
at [WILDCARD]/test/fail_fast_with_val.ts:5:9
at [WILDCARD]
failures:
FAILURES
test 1 => ./test/fail_fast_with_val.ts:[WILDCARD]
test 2 => ./test/fail_fast_with_val.ts:[WILDCARD]

View file

@ -3,7 +3,7 @@ running 2 tests from ./test/finally_timeout.ts
error ... FAILED ([WILDCARD])
success ... ok ([WILDCARD])
failures:
ERRORS
error => ./test/finally_timeout.ts:[WILDCARD]
error: Error: fail
@ -11,7 +11,7 @@ error: Error: fail
^
at [WILDCARD]/test/finally_timeout.ts:4:11
failures:
FAILURES
error => ./test/finally_timeout.ts:[WILDCARD]

View file

@ -1,13 +1,13 @@
running 1 test from ./test/no_prompt_by_default.ts
no prompt ... FAILED ([WILDCARD]ms)
failures:
ERRORS
no prompt => ./test/no_prompt_by_default.ts:[WILDCARD]
error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD]
failures:
FAILURES
no prompt => ./test/no_prompt_by_default.ts:[WILDCARD]

View file

@ -1,13 +1,13 @@
running 1 test from ./test/no_prompt_with_denied_perms.ts
no prompt ... FAILED ([WILDCARD]ms)
failures:
ERRORS
no prompt => ./test/no_prompt_with_denied_perms.ts:[WILDCARD]
error: PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD]
failures:
FAILURES
no prompt => ./test/no_prompt_with_denied_perms.ts:[WILDCARD]

View file

@ -2,7 +2,7 @@ Check [WILDCARD]test/ops_sanitizer_missing_details.ts
running 1 test from ./test/ops_sanitizer_missing_details.ts
test 1 ... FAILED [WILDCARD]
failures:
ERRORS
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]
error: Test case is leaking async ops.
@ -11,7 +11,7 @@ error: Test case is leaking async ops.
To get more details where ops were leaked, run again with --trace-ops flag.
failures:
FAILURES
test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD]

View file

@ -3,7 +3,7 @@ running 2 tests from ./test/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])
failures:
ERRORS
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Test case is leaking async ops.
@ -37,7 +37,7 @@ error: Test case is leaking async ops.
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27
at [WILDCARD]
failures:
FAILURES
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]

View file

@ -3,7 +3,7 @@ running 2 tests from ./test/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])
failures:
ERRORS
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
error: Test case is leaking async ops.
@ -19,7 +19,7 @@ error: Test case is leaking async ops.
To get more details where ops were leaked, run again with --trace-ops flag.
failures:
FAILURES
test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]
test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD]

View file

@ -3,7 +3,7 @@ running 2 tests from ./test/ops_sanitizer_unstable.ts
no-op ... ok ([WILDCARD])
leak interval ... FAILED ([WILDCARD])
failures:
ERRORS
leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]
error: Test case is leaking async ops.
@ -14,7 +14,7 @@ error: Test case is leaking async ops.
at [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:3:3
at [WILDCARD]
failures:
FAILURES
leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD]

View file

@ -2,7 +2,7 @@ Check [WILDCARD]/test/resource_sanitizer.ts
running 1 test from ./test/resource_sanitizer.ts
leak ... FAILED ([WILDCARD])
failures:
ERRORS
leak => ./test/resource_sanitizer.ts:[WILDCARD]
error: AssertionError: Test case is leaking 2 resources:
@ -12,7 +12,7 @@ error: AssertionError: Test case is leaking 2 resources:
at [WILDCARD]
failures:
FAILURES
leak => ./test/resource_sanitizer.ts:[WILDCARD]

View file

@ -33,7 +33,7 @@ failing step in failing test ...
at [WILDCARD]
FAILED ([WILDCARD])
failures:
ERRORS
nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
error: Error: 1 test step failed.
@ -51,7 +51,7 @@ error: Error: Fail test.
^
at [WILDCARD]/failing_steps.ts:[WILDCARD]
failures:
FAILURES
nested failure => ./test/steps/failing_steps.ts:[WILDCARD]
multiple test step failures => ./test/steps/failing_steps.ts:[WILDCARD]

View file

@ -64,7 +64,7 @@ parallel steps where only inner tests have sanitizers ...
FAILED ([WILDCARD])
FAILED ([WILDCARD])
failures:
ERRORS
capturing => ./test/steps/invalid_usage.ts:[WILDCARD]
error: Error: Cannot run test step after parent scope has finished execution. Ensure any `.step(...)` calls are executed before their parent scope completes execution.
@ -99,7 +99,7 @@ error: Error: 1 test step failed.
at runTest ([WILDCARD])
at [WILDCARD]
failures:
FAILURES
capturing => ./test/steps/invalid_usage.ts:[WILDCARD]
top level missing await => ./test/steps/invalid_usage.ts:[WILDCARD]

View file

@ -452,7 +452,7 @@ impl TestReporter for PrettyTestReporter {
fn report_summary(&mut self, summary: &TestSummary, elapsed: &Duration) {
if !summary.failures.is_empty() {
let mut failure_titles = vec![];
println!("\nfailures:\n");
println!("\n{}\n", colors::white_bold_on_red(" ERRORS "));
for (description, js_error) in &summary.failures {
let failure_title = format!(
"{} {}",
@ -475,7 +475,7 @@ impl TestReporter for PrettyTestReporter {
failure_titles.push(failure_title);
}
println!("failures:\n");
println!("{}\n", colors::white_bold_on_red(" FAILURES "));
for failure_title in failure_titles {
println!("{}", failure_title);
}

View file

@ -123,3 +123,12 @@ pub fn intense_blue<S: AsRef<str>>(s: S) -> impl fmt::Display {
style_spec.set_fg(Some(Blue)).set_intense(true);
style(s, style_spec)
}
pub fn white_bold_on_red<S: AsRef<str>>(s: S) -> impl fmt::Display {
let mut style_spec = ColorSpec::new();
style_spec
.set_bold(true)
.set_bg(Some(Red))
.set_fg(Some(White));
style(s, style_spec)
}