summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-05-09 10:56:13 +0200
committerGitHub <noreply@github.com>2022-05-09 10:56:13 +0200
commitab728e9ccfff2d1ac6362b22b579b00120a39f67 (patch)
treec7577ea32790d8814ade1431b927035da76df23a
parentd0f5cd6a069e6a416e58b4ece456d134135b11d3 (diff)
feat(test): change "failures:" headers in test report (#14490)
-rw-r--r--cli/tests/testdata/compat/test_runner/cjs.out4
-rw-r--r--cli/tests/testdata/compat/test_runner/esm.out4
-rw-r--r--cli/tests/testdata/test/aggregate_error.out4
-rw-r--r--cli/tests/testdata/test/allow_none.out4
-rw-r--r--cli/tests/testdata/test/exit_sanitizer.out4
-rw-r--r--cli/tests/testdata/test/fail.out4
-rw-r--r--cli/tests/testdata/test/fail_fast.out4
-rw-r--r--cli/tests/testdata/test/fail_fast_with_val.out4
-rw-r--r--cli/tests/testdata/test/finally_timeout.out4
-rw-r--r--cli/tests/testdata/test/no_prompt_by_default.out4
-rw-r--r--cli/tests/testdata/test/no_prompt_with_denied_perms.out4
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_missing_details.out4
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out4
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out4
-rw-r--r--cli/tests/testdata/test/ops_sanitizer_unstable.out4
-rw-r--r--cli/tests/testdata/test/resource_sanitizer.out4
-rw-r--r--cli/tests/testdata/test/steps/failing_steps.out4
-rw-r--r--cli/tests/testdata/test/steps/invalid_usage.out4
-rw-r--r--cli/tools/test.rs4
-rw-r--r--runtime/colors.rs9
20 files changed, 47 insertions, 38 deletions
diff --git a/cli/tests/testdata/compat/test_runner/cjs.out b/cli/tests/testdata/compat/test_runner/cjs.out
index 918a06b1a..84f506642 100644
--- a/cli/tests/testdata/compat/test_runner/cjs.out
+++ b/cli/tests/testdata/compat/test_runner/cjs.out
@@ -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]
diff --git a/cli/tests/testdata/compat/test_runner/esm.out b/cli/tests/testdata/compat/test_runner/esm.out
index 7660a3d2a..9184228b7 100644
--- a/cli/tests/testdata/compat/test_runner/esm.out
+++ b/cli/tests/testdata/compat/test_runner/esm.out
@@ -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]
diff --git a/cli/tests/testdata/test/aggregate_error.out b/cli/tests/testdata/test/aggregate_error.out
index dacce8979..c21416e01 100644
--- a/cli/tests/testdata/test/aggregate_error.out
+++ b/cli/tests/testdata/test/aggregate_error.out
@@ -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]
diff --git a/cli/tests/testdata/test/allow_none.out b/cli/tests/testdata/test/allow_none.out
index 241a5dd1a..f52eadb82 100644
--- a/cli/tests/testdata/test/allow_none.out
+++ b/cli/tests/testdata/test/allow_none.out
@@ -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]
diff --git a/cli/tests/testdata/test/exit_sanitizer.out b/cli/tests/testdata/test/exit_sanitizer.out
index 4e117b7b6..9ed9a77f9 100644
--- a/cli/tests/testdata/test/exit_sanitizer.out
+++ b/cli/tests/testdata/test/exit_sanitizer.out
@@ -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]
diff --git a/cli/tests/testdata/test/fail.out b/cli/tests/testdata/test/fail.out
index f996487e1..3b33506e9 100644
--- a/cli/tests/testdata/test/fail.out
+++ b/cli/tests/testdata/test/fail.out
@@ -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
diff --git a/cli/tests/testdata/test/fail_fast.out b/cli/tests/testdata/test/fail_fast.out
index 75630072b..cbfc6ee44 100644
--- a/cli/tests/testdata/test/fail_fast.out
+++ b/cli/tests/testdata/test/fail_fast.out
@@ -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]
diff --git a/cli/tests/testdata/test/fail_fast_with_val.out b/cli/tests/testdata/test/fail_fast_with_val.out
index aeb51a20a..62138830b 100644
--- a/cli/tests/testdata/test/fail_fast_with_val.out
+++ b/cli/tests/testdata/test/fail_fast_with_val.out
@@ -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]
diff --git a/cli/tests/testdata/test/finally_timeout.out b/cli/tests/testdata/test/finally_timeout.out
index f72dbce95..593b9059b 100644
--- a/cli/tests/testdata/test/finally_timeout.out
+++ b/cli/tests/testdata/test/finally_timeout.out
@@ -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]
diff --git a/cli/tests/testdata/test/no_prompt_by_default.out b/cli/tests/testdata/test/no_prompt_by_default.out
index f577337d8..4995a4269 100644
--- a/cli/tests/testdata/test/no_prompt_by_default.out
+++ b/cli/tests/testdata/test/no_prompt_by_default.out
@@ -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]
diff --git a/cli/tests/testdata/test/no_prompt_with_denied_perms.out b/cli/tests/testdata/test/no_prompt_with_denied_perms.out
index 695323043..93e4ae5e8 100644
--- a/cli/tests/testdata/test/no_prompt_with_denied_perms.out
+++ b/cli/tests/testdata/test/no_prompt_with_denied_perms.out
@@ -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]
diff --git a/cli/tests/testdata/test/ops_sanitizer_missing_details.out b/cli/tests/testdata/test/ops_sanitizer_missing_details.out
index f5fd086b7..58d656012 100644
--- a/cli/tests/testdata/test/ops_sanitizer_missing_details.out
+++ b/cli/tests/testdata/test/ops_sanitizer_missing_details.out
@@ -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]
diff --git a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
index 954e41788..bb9229c02 100644
--- a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
+++ b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out
@@ -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]
diff --git a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
index e4ca9b906..7b2dc168b 100644
--- a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
+++ b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out
@@ -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]
diff --git a/cli/tests/testdata/test/ops_sanitizer_unstable.out b/cli/tests/testdata/test/ops_sanitizer_unstable.out
index b8cbf33cb..8be4e4551 100644
--- a/cli/tests/testdata/test/ops_sanitizer_unstable.out
+++ b/cli/tests/testdata/test/ops_sanitizer_unstable.out
@@ -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]
diff --git a/cli/tests/testdata/test/resource_sanitizer.out b/cli/tests/testdata/test/resource_sanitizer.out
index 949ec64a7..f5d097783 100644
--- a/cli/tests/testdata/test/resource_sanitizer.out
+++ b/cli/tests/testdata/test/resource_sanitizer.out
@@ -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]
diff --git a/cli/tests/testdata/test/steps/failing_steps.out b/cli/tests/testdata/test/steps/failing_steps.out
index 5baa09ce7..d42736977 100644
--- a/cli/tests/testdata/test/steps/failing_steps.out
+++ b/cli/tests/testdata/test/steps/failing_steps.out
@@ -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]
diff --git a/cli/tests/testdata/test/steps/invalid_usage.out b/cli/tests/testdata/test/steps/invalid_usage.out
index afa19c53d..c3e47c37e 100644
--- a/cli/tests/testdata/test/steps/invalid_usage.out
+++ b/cli/tests/testdata/test/steps/invalid_usage.out
@@ -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]
diff --git a/cli/tools/test.rs b/cli/tools/test.rs
index dc3eeba3b..38c6919cc 100644
--- a/cli/tools/test.rs
+++ b/cli/tools/test.rs
@@ -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);
}
diff --git a/runtime/colors.rs b/runtime/colors.rs
index f9d48fe53..7159db9f6 100644
--- a/runtime/colors.rs
+++ b/runtime/colors.rs
@@ -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)
+}