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

feat(test): Improve testing report output (#14255)

Following changes were done in this commit:

- remove "test" prefix before each test
- use gray color for "running N tests from ..." prompt
- use relative path or remote URL instead of full URL in "running N tests from ..." prompt
- in "failures" section, add file path/remote URL before the test name

Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
Bartek Iwańczuk 2022-04-11 18:27:17 +02:00 committed by GitHub
parent c154ac5168
commit c8313a7457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 333 additions and 277 deletions

View file

@ -13,9 +13,9 @@ fn no_color() {
false,
);
// ANSI escape codes should be stripped.
assert!(out.contains("test success ... ok"));
assert!(out.contains("test fail ... FAILED"));
assert!(out.contains("test ignored ... ignored"));
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"));
}

View file

@ -1,10 +1,10 @@
running 2 tests from [WILDCARD]
test Correct assertion ... ok ([WILDCARD])
test Failed assertion ... FAILED ([WILDCARD])
running 2 tests from compat/test_runner/cjs.js
Correct assertion ... ok ([WILDCARD])
Failed assertion ... FAILED ([WILDCARD])
failures:
Failed assertion
compat/test_runner/cjs.js > Failed assertion
AssertionError [ERR_ASSERTION]: Values are not strictly equal:
@ -18,7 +18,8 @@ AssertionError [ERR_ASSERTION]: Values are not strictly equal:
failures:
[WILDCARD]Failed assertion
compat/test_runner/cjs.js
Failed assertion
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,10 +1,10 @@
running 2 tests from [WILDCARD]
test Correct assertion ... ok ([WILDCARD])
test Failed assertion ... FAILED ([WILDCARD])
running 2 tests from compat/test_runner/esm.mjs
Correct assertion ... ok ([WILDCARD])
Failed assertion ... FAILED ([WILDCARD])
failures:
Failed assertion
compat/test_runner/esm.mjs > Failed assertion
AssertionError [ERR_ASSERTION]: Values are not strictly equal:
@ -18,7 +18,8 @@ AssertionError [ERR_ASSERTION]: Values are not strictly equal:
failures:
[WILDCARD]Failed assertion
compat/test_runner/esm.mjs
Failed assertion
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,10 +1,10 @@
Check [WILDCARD]/testdata/test/aggregate_error.ts
running 1 test from [WILDCARD]/testdata/test/aggregate_error.ts
test aggregate ... FAILED ([WILDCARD])
running 1 test from test/aggregate_error.ts
aggregate ... FAILED ([WILDCARD])
failures:
aggregate
test/aggregate_error.ts > aggregate
AggregateError
Error: Error 1
at [WILDCARD]/testdata/test/aggregate_error.ts:2:18
@ -17,6 +17,7 @@ AggregateError
failures:
test/aggregate_error.ts
aggregate
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,18 +1,18 @@
[WILDCARD]
running 14 tests from [WILDCARD]
test read false ... ok [WILDCARD]
test read true ... ok [WILDCARD]
test write false ... ok [WILDCARD]
test write true ... ok [WILDCARD]
test net false ... ok [WILDCARD]
test net true ... ok [WILDCARD]
test env false ... ok [WILDCARD]
test env true ... ok [WILDCARD]
test run false ... ok [WILDCARD]
test run true ... ok [WILDCARD]
test ffi false ... ok [WILDCARD]
test ffi true ... ok [WILDCARD]
test hrtime false ... ok [WILDCARD]
test hrtime true ... ok [WILDCARD]
read false ... ok [WILDCARD]
read true ... ok [WILDCARD]
write false ... ok [WILDCARD]
write true ... ok [WILDCARD]
net false ... ok [WILDCARD]
net true ... ok [WILDCARD]
env false ... ok [WILDCARD]
env true ... ok [WILDCARD]
run false ... ok [WILDCARD]
run true ... ok [WILDCARD]
ffi false ... ok [WILDCARD]
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]

View file

@ -1,45 +1,46 @@
[WILDCARD]
running 7 tests from [WILDCARD]
test read ... FAILED [WILDCARD]
test write ... FAILED [WILDCARD]
test net ... FAILED [WILDCARD]
test env ... FAILED [WILDCARD]
test run ... FAILED [WILDCARD]
test ffi ... FAILED [WILDCARD]
test hrtime ... FAILED [WILDCARD]
read ... FAILED [WILDCARD]
write ... FAILED [WILDCARD]
net ... FAILED [WILDCARD]
env ... FAILED [WILDCARD]
run ... FAILED [WILDCARD]
ffi ... FAILED [WILDCARD]
hrtime ... FAILED [WILDCARD]
failures:
read
test/allow_none.ts > read
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
write
test/allow_none.ts > write
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
net
test/allow_none.ts > net
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
env
test/allow_none.ts > env
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
run
test/allow_none.ts > run
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
ffi
test/allow_none.ts > ffi
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
hrtime
test/allow_none.ts > hrtime
PermissionDenied: Can't escalate parent thread permissions
[WILDCARD]
failures:
test/allow_none.ts
read
write
net

View file

@ -1,8 +1,8 @@
Check [WILDCARD]/test/clear_timeout.ts
running 3 tests from [WILDCARD]/test/clear_timeout.ts
test test 1 ... ok ([WILDCARD])
test test 2 ... ok ([WILDCARD])
test test 3 ... ok ([WILDCARD])
running 3 tests from test/clear_timeout.ts
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])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/collect/test.ts
running 0 tests from [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])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/doc_only/mod.ts$2-5.ts
running 0 tests from [WILDCARD]/test/doc_only/mod.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])

View file

@ -1,24 +1,24 @@
Check [WILDCARD]/test/exit_sanitizer.ts
running 3 tests from [WILDCARD]/test/exit_sanitizer.ts
test exit(0) ... FAILED ([WILDCARD])
test exit(1) ... FAILED ([WILDCARD])
test exit(2) ... FAILED ([WILDCARD])
running 3 tests from test/exit_sanitizer.ts
exit(0) ... FAILED ([WILDCARD])
exit(1) ... FAILED ([WILDCARD])
exit(2) ... FAILED ([WILDCARD])
failures:
exit(0)
test/exit_sanitizer.ts > exit(0)
AssertionError: Test case attempted to exit with exit code: 0
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:2:8
at [WILDCARD]
exit(1)
test/exit_sanitizer.ts > exit(1)
AssertionError: Test case attempted to exit with exit code: 1
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:6:8
at [WILDCARD]
exit(2)
test/exit_sanitizer.ts > exit(2)
AssertionError: Test case attempted to exit with exit code: 2
at [WILDCARD]
at [WILDCARD]/test/exit_sanitizer.ts:10:8
@ -26,6 +26,7 @@ AssertionError: Test case attempted to exit with exit code: 2
failures:
test/exit_sanitizer.ts
exit(0)
exit(1)
exit(2)

View file

@ -1,70 +1,71 @@
Check [WILDCARD]/test/fail.ts
running 10 tests from [WILDCARD]/test/fail.ts
test test 0 ... FAILED ([WILDCARD])
test test 1 ... FAILED ([WILDCARD])
test test 2 ... FAILED ([WILDCARD])
test test 3 ... FAILED ([WILDCARD])
test test 4 ... FAILED ([WILDCARD])
test test 5 ... FAILED ([WILDCARD])
test test 6 ... FAILED ([WILDCARD])
test test 7 ... FAILED ([WILDCARD])
test test 8 ... FAILED ([WILDCARD])
test test 9 ... FAILED ([WILDCARD])
running 10 tests from test/fail.ts
test 0 ... FAILED ([WILDCARD])
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])
test 3 ... FAILED ([WILDCARD])
test 4 ... FAILED ([WILDCARD])
test 5 ... FAILED ([WILDCARD])
test 6 ... FAILED ([WILDCARD])
test 7 ... FAILED ([WILDCARD])
test 8 ... FAILED ([WILDCARD])
test 9 ... FAILED ([WILDCARD])
failures:
test 0
test/fail.ts > test 0
Error
at [WILDCARD]/test/fail.ts:2:9
at [WILDCARD]
test 1
test/fail.ts > test 1
Error
at [WILDCARD]/test/fail.ts:5:9
at [WILDCARD]
test 2
test/fail.ts > test 2
Error
at [WILDCARD]/test/fail.ts:8:9
at [WILDCARD]
test 3
test/fail.ts > test 3
Error
at [WILDCARD]/test/fail.ts:11:9
at [WILDCARD]
test 4
test/fail.ts > test 4
Error
at [WILDCARD]/test/fail.ts:14:9
at [WILDCARD]
test 5
test/fail.ts > test 5
Error
at [WILDCARD]/test/fail.ts:17:9
at [WILDCARD]
test 6
test/fail.ts > test 6
Error
at [WILDCARD]/test/fail.ts:20:9
at [WILDCARD]
test 7
test/fail.ts > test 7
Error
at [WILDCARD]/test/fail.ts:23:9
at [WILDCARD]
test 8
test/fail.ts > test 8
Error
at [WILDCARD]/test/fail.ts:26:9
at [WILDCARD]
test 9
test/fail.ts > test 9
Error
at [WILDCARD]/test/fail.ts:29:9
at [WILDCARD]
failures:
test/fail.ts
test 0
test 1
test 2

View file

@ -1,16 +1,17 @@
Check [WILDCARD]/test/fail_fast.ts
running 10 tests from [WILDCARD]/test/fail_fast.ts
test test 1 ... FAILED ([WILDCARD])
running 10 tests from test/fail_fast.ts
test 1 ... FAILED ([WILDCARD])
failures:
test 1
test/fail_fast.ts > test 1
Error
at [WILDCARD]/test/fail_fast.ts:2:9
at [WILDCARD]
failures:
test/fail_fast.ts
test 1
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,12 +1,12 @@
Check [WILDCARD]/test/filter/a_test.ts
Check [WILDCARD]/test/filter/b_test.ts
Check [WILDCARD]/test/filter/c_test.ts
running 1 test from [WILDCARD]/test/filter/a_test.ts
test foo ... ok ([WILDCARD])
running 1 test from [WILDCARD]/test/filter/b_test.ts
test foo ... ok ([WILDCARD])
running 1 test from [WILDCARD]/test/filter/c_test.ts
test foo ... ok ([WILDCARD])
running 1 test from test/filter/a_test.ts
foo ... ok ([WILDCARD])
running 1 test from test/filter/b_test.ts
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])

View file

@ -1,17 +1,18 @@
Check [WILDCARD]/test/finally_timeout.ts
running 2 tests from [WILDCARD]/test/finally_timeout.ts
test error ... FAILED ([WILDCARD])
test success ... ok ([WILDCARD])
running 2 tests from test/finally_timeout.ts
error ... FAILED ([WILDCARD])
success ... ok ([WILDCARD])
failures:
error
test/finally_timeout.ts > error
Error: fail
at [WILDCARD]/test/finally_timeout.ts:4:11
at [WILDCARD]
failures:
test/finally_timeout.ts
error
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,15 +1,15 @@
Check [WILDCARD]/test/ignore.ts
running 10 tests from [WILDCARD]/test/ignore.ts
test test 0 ... ignored ([WILDCARD])
test test 1 ... ignored ([WILDCARD])
test test 2 ... ignored ([WILDCARD])
test test 3 ... ignored ([WILDCARD])
test test 4 ... ignored ([WILDCARD])
test test 5 ... ignored ([WILDCARD])
test test 6 ... ignored ([WILDCARD])
test test 7 ... ignored ([WILDCARD])
test test 8 ... ignored ([WILDCARD])
test test 9 ... ignored ([WILDCARD])
running 10 tests from test/ignore.ts
test 0 ... ignored ([WILDCARD])
test 1 ... ignored ([WILDCARD])
test 2 ... ignored ([WILDCARD])
test 3 ... ignored ([WILDCARD])
test 4 ... ignored ([WILDCARD])
test 5 ... ignored ([WILDCARD])
test 6 ... ignored ([WILDCARD])
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])

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/test/ignore_permissions.ts
running 1 test from [WILDCARD]/test/ignore_permissions.ts
test ignore ... ignored ([WILDCARD])
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])

View file

@ -1,5 +1,5 @@
Check [WILDCARD]/test/interval.ts
running 0 tests from [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])

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/test/load_unload.ts
running 1 test from [WILDCARD]/test/load_unload.ts
test test ... ok ([WILDCARD])
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])

View file

@ -1,7 +1,7 @@
Check [WILDCARD]/test/meta.ts
import.meta.main: false
import.meta.url: [WILDCARD]/test/meta.ts
running 0 tests from [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])

View file

@ -1,15 +1,16 @@
Check [WILDCARD]/no_prompt_by_default.ts
running 1 test from [WILDCARD]/no_prompt_by_default.ts
test no prompt ... FAILED ([WILDCARD]ms)
running 1 test from test/no_prompt_by_default.ts
no prompt ... FAILED ([WILDCARD]ms)
failures:
no prompt
test/no_prompt_by_default.ts > no prompt
PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD]
failures:
test/no_prompt_by_default.ts
no prompt
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms)

View file

@ -1,15 +1,16 @@
Check [WILDCARD]/no_prompt_with_denied_perms.ts
running 1 test from [WILDCARD]/no_prompt_with_denied_perms.ts
test no prompt ... FAILED ([WILDCARD]ms)
running 1 test from test/no_prompt_with_denied_perms.ts
no prompt ... FAILED ([WILDCARD]ms)
failures:
no prompt
test/no_prompt_with_denied_perms.ts > no prompt
PermissionDenied: Requires read access to "./some_file.txt", run again with the --allow-read flag
[WILDCARD]
failures:
test/no_prompt_with_denied_perms.ts
no prompt
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]ms)

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/test/only.ts
running 1 test from [WILDCARD]/test/only.ts
test only ... ok ([WILDCARD])
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])

View file

@ -1,10 +1,10 @@
Check [WILDCARD]test/ops_sanitizer_missing_details.ts
running 1 test from [WILDCARD]test/ops_sanitizer_missing_details.ts
test test 1 ... FAILED [WILDCARD]
running 1 test from test/ops_sanitizer_missing_details.ts
test 1 ... FAILED [WILDCARD]
failures:
test 1
test/ops_sanitizer_missing_details.ts > test 1
Test case is leaking async ops.
- 1 async operation to op_write was started in this test, but never completed.
@ -13,6 +13,7 @@ To get more details where ops were leaked, run again with --trace-ops flag.
failures:
test/ops_sanitizer_missing_details.ts
test 1
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]

View file

@ -1,11 +1,11 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
test test 1 ... FAILED ([WILDCARD])
test test 2 ... FAILED ([WILDCARD])
running 2 tests from test/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])
failures:
test 1
test/ops_sanitizer_multiple_timeout_tests.ts > test 1
Test case is leaking async ops.
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
@ -21,7 +21,7 @@ Test case is leaking async ops.
at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27
at [WILDCARD]
test 2
test/ops_sanitizer_multiple_timeout_tests.ts > test 2
Test case is leaking async ops.
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operations were started here:
@ -39,6 +39,7 @@ Test case is leaking async ops.
failures:
test/ops_sanitizer_multiple_timeout_tests.ts
test 1
test 2

View file

@ -1,18 +1,18 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
running 2 tests from [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts
test test 1 ... FAILED ([WILDCARD])
test test 2 ... FAILED ([WILDCARD])
running 2 tests from test/ops_sanitizer_multiple_timeout_tests.ts
test 1 ... FAILED ([WILDCARD])
test 2 ... FAILED ([WILDCARD])
failures:
test 1
test/ops_sanitizer_multiple_timeout_tests.ts > test 1
Test case is leaking async ops.
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
To get more details where ops were leaked, run again with --trace-ops flag.
test 2
test/ops_sanitizer_multiple_timeout_tests.ts > test 2
Test case is leaking async ops.
- 2 async operations to sleep for a duration were started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call.
@ -21,6 +21,7 @@ To get more details where ops were leaked, run again with --trace-ops flag.
failures:
test/ops_sanitizer_multiple_timeout_tests.ts
test 1
test 2

View file

@ -1,7 +1,7 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_nexttick.ts
running 2 tests from [WILDCARD]/testdata/test/ops_sanitizer_nexttick.ts
test test 1 ... ok ([WILDCARD])
test test 2 ... ok ([WILDCARD])
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])

View file

@ -1,6 +1,6 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_timeout_failure.ts
running 1 test from [WILDCARD]/testdata/test/ops_sanitizer_timeout_failure.ts
test wait ... ok ([WILDCARD])
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])

View file

@ -1,11 +1,11 @@
Check [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts
running 2 tests from [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts
test no-op ... ok ([WILDCARD])
test leak interval ... FAILED ([WILDCARD])
running 2 tests from test/ops_sanitizer_unstable.ts
no-op ... ok ([WILDCARD])
leak interval ... FAILED ([WILDCARD])
failures:
leak interval
test/ops_sanitizer_unstable.ts > leak interval
Test case is leaking async ops.
- 1 async operation to sleep for a duration was started in this test, but never completed. This is often caused by not cancelling a `setTimeout` or `setInterval` call. The operation was started here:
@ -16,6 +16,7 @@ Test case is leaking async ops.
failures:
test/ops_sanitizer_unstable.ts
leak interval
test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,11 +1,11 @@
Check [WILDCARD]/test/overloads.ts
running 6 tests from [WILDCARD]/test/overloads.ts
test test0 ... ok ([WILDCARD])
test test1 ... ok ([WILDCARD])
test test2 ... ok ([WILDCARD])
test test3 ... ok ([WILDCARD])
test test4 ... ok ([WILDCARD])
test test5 ... ignored ([WILDCARD])
running 6 tests from test/overloads.ts
test0 ... ok ([WILDCARD])
test1 ... ok ([WILDCARD])
test2 ... ok ([WILDCARD])
test3 ... ok ([WILDCARD])
test4 ... ok ([WILDCARD])
test5 ... ignored ([WILDCARD])
test result: ok. 5 passed; 0 failed; 1 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,15 +1,15 @@
Check [WILDCARD]/test/pass.ts
running 10 tests from [WILDCARD]/test/pass.ts
test test 0 ... ok ([WILDCARD])
test test 1 ... ok ([WILDCARD])
test test 2 ... ok ([WILDCARD])
test test 3 ... ok ([WILDCARD])
test test 4 ... ok ([WILDCARD])
test test 5 ... ok ([WILDCARD])
test test 6 ... ok ([WILDCARD])
test test 7 ... ok ([WILDCARD])
test test 8 ... ok ([WILDCARD])
test test 9 ... ok ([WILDCARD])
running 10 tests from test/pass.ts
test 0 ... ok ([WILDCARD])
test 1 ... ok ([WILDCARD])
test 2 ... ok ([WILDCARD])
test 3 ... ok ([WILDCARD])
test 4 ... ok ([WILDCARD])
test 5 ... ok ([WILDCARD])
test 6 ... ok ([WILDCARD])
test 7 ... ok ([WILDCARD])
test 8 ... ok ([WILDCARD])
test 9 ... ok ([WILDCARD])
test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,8 +1,8 @@
running 4 tests from [WILDCARD]/test/quiet.ts
test console.log ... ok ([WILDCARD])
test console.error ... ok ([WILDCARD])
test console.info ... ok ([WILDCARD])
test console.warn ... ok ([WILDCARD])
running 4 tests from test/quiet.ts
console.log ... ok ([WILDCARD])
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])

View file

@ -1,10 +1,10 @@
Check [WILDCARD]/test/resource_sanitizer.ts
running 1 test from [WILDCARD]/test/resource_sanitizer.ts
test leak ... FAILED ([WILDCARD])
running 1 test from test/resource_sanitizer.ts
leak ... FAILED ([WILDCARD])
failures:
leak
test/resource_sanitizer.ts > leak
AssertionError: Test case is leaking 2 resources:
- The stdin pipe (rid 0) was opened before the test started, but was closed during the test. Do not close resources in a test that were not created during that test.
@ -14,6 +14,7 @@ AssertionError: Test case is leaking 2 resources:
failures:
test/resource_sanitizer.ts
leak
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])

View file

@ -1,39 +1,39 @@
Check [WILDCARD]/test/shuffle/bar_test.ts
Check [WILDCARD]/test/shuffle/baz_test.ts
Check [WILDCARD]/test/shuffle/foo_test.ts
running 10 tests from [WILDCARD]/test/shuffle/foo_test.ts
test test 2 ... ok ([WILDCARD])
test test 3 ... ok ([WILDCARD])
test test 6 ... ok ([WILDCARD])
test test 9 ... ok ([WILDCARD])
test test 8 ... ok ([WILDCARD])
test test 7 ... ok ([WILDCARD])
test test 5 ... ok ([WILDCARD])
test test 4 ... ok ([WILDCARD])
test test 1 ... ok ([WILDCARD])
test test 0 ... ok ([WILDCARD])
running 10 tests from [WILDCARD]/test/shuffle/baz_test.ts
test test 2 ... ok ([WILDCARD])
test test 3 ... ok ([WILDCARD])
test test 6 ... ok ([WILDCARD])
test test 9 ... ok ([WILDCARD])
test test 8 ... ok ([WILDCARD])
test test 7 ... ok ([WILDCARD])
test test 5 ... ok ([WILDCARD])
test test 4 ... ok ([WILDCARD])
test test 1 ... ok ([WILDCARD])
test test 0 ... ok ([WILDCARD])
running 10 tests from [WILDCARD]/test/shuffle/bar_test.ts
test test 2 ... ok ([WILDCARD])
test test 3 ... ok ([WILDCARD])
test test 6 ... ok ([WILDCARD])
test test 9 ... ok ([WILDCARD])
test test 8 ... ok ([WILDCARD])
test test 7 ... ok ([WILDCARD])
test test 5 ... ok ([WILDCARD])
test test 4 ... ok ([WILDCARD])
test test 1 ... ok ([WILDCARD])
test test 0 ... ok ([WILDCARD])
running 10 tests from test/shuffle/foo_test.ts
test 2 ... ok ([WILDCARD])
test 3 ... ok ([WILDCARD])
test 6 ... ok ([WILDCARD])
test 9 ... ok ([WILDCARD])
test 8 ... ok ([WILDCARD])
test 7 ... ok ([WILDCARD])
test 5 ... ok ([WILDCARD])
test 4 ... ok ([WILDCARD])
test 1 ... ok ([WILDCARD])
test 0 ... ok ([WILDCARD])
running 10 tests from test/shuffle/baz_test.ts
test 2 ... ok ([WILDCARD])
test 3 ... ok ([WILDCARD])
test 6 ... ok ([WILDCARD])
test 9 ... ok ([WILDCARD])
test 8 ... ok ([WILDCARD])
test 7 ... ok ([WILDCARD])
test 5 ... ok ([WILDCARD])
test 4 ... ok ([WILDCARD])
test 1 ... ok ([WILDCARD])
test 0 ... ok ([WILDCARD])
running 10 tests from test/shuffle/bar_test.ts
test 2 ... ok ([WILDCARD])
test 3 ... ok ([WILDCARD])
test 6 ... ok ([WILDCARD])
test 9 ... ok ([WILDCARD])
test 8 ... ok ([WILDCARD])
test 7 ... ok ([WILDCARD])
test 5 ... ok ([WILDCARD])
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])

View file

@ -1,25 +1,25 @@
[WILDCARD]
running 3 tests from [WILDCARD]/failing_steps.ts
test nested failure ...
test step 1 ...
test inner 1 ... FAILED ([WILDCARD])
running 3 tests from test/steps/failing_steps.ts
nested failure ...
step 1 ...
inner 1 ... FAILED ([WILDCARD])
Error: Failed.
at [WILDCARD]/failing_steps.ts:[WILDCARD]
[WILDCARD]
test inner 2 ... ok ([WILDCARD])
inner 2 ... ok ([WILDCARD])
FAILED ([WILDCARD])
FAILED ([WILDCARD])
test multiple test step failures ...
test step 1 ... FAILED ([WILDCARD])
multiple test step failures ...
step 1 ... FAILED ([WILDCARD])
Error: Fail.
[WILDCARD]
test step 2 ... FAILED ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
Error: Fail.
at [WILDCARD]/failing_steps.ts:[WILDCARD]
[WILDCARD]
FAILED ([WILDCARD])
test failing step in failing test ...
test step 1 ... FAILED ([WILDCARD])
failing step in failing test ...
step 1 ... FAILED ([WILDCARD])
Error: Fail.
at [WILDCARD]/failing_steps.ts:[WILDCARD]
at [WILDCARD]
@ -27,23 +27,24 @@ FAILED ([WILDCARD])
failures:
nested failure
test/steps/failing_steps.ts > nested failure
Error: 1 test step failed.
at runTest (deno:runtime/js/40_testing.js:[WILDCARD])
at async Object.runTests (deno:runtime/js/40_testing.js:[WILDCARD])
multiple test step failures
test/steps/failing_steps.ts > multiple test step failures
Error: 2 test steps failed.
at runTest (deno:runtime/js/40_testing.js:[WILDCARD])
at async Object.runTests (deno:runtime/js/40_testing.js:[WILDCARD])
failing step in failing test
test/steps/failing_steps.ts > failing step in failing test
Error: Fail test.
at [WILDCARD]/failing_steps.ts:[WILDCARD]
at [WILDCARD]
failures:
test/steps/failing_steps.ts
nested failure
multiple test step failures
failing step in failing test

View file

@ -1,8 +1,8 @@
[WILDCARD]
running 1 test from [WILDCARD]/ignored_steps.ts
test ignored step ...
test step 1 ... ignored ([WILDCARD])
test step 2 ... ok ([WILDCARD])
running 1 test from test/steps/ignored_steps.ts
ignored step ...
step 1 ... ignored ([WILDCARD])
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]

View file

@ -1,14 +1,14 @@
[WILDCARD]
running 7 tests from [WILDCARD]/invalid_usage.ts
test capturing ...
test some step ... ok ([WILDCARD])
running 7 tests from test/steps/invalid_usage.ts
capturing ...
some step ... ok ([WILDCARD])
FAILED ([WILDCARD])
test top level missing await ...
test step ... pending ([WILDCARD])
top level missing await ...
step ... pending ([WILDCARD])
FAILED ([WILDCARD])
test inner missing await ...
test step ...
test inner ... pending ([WILDCARD])
inner missing await ...
step ...
inner ... pending ([WILDCARD])
Error: Parent scope completed before test step finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
at postValidation [WILDCARD]
at testStepSanitizer [WILDCARD]
@ -19,9 +19,9 @@ test inner missing await ...
at async fn ([WILDCARD]/invalid_usage.ts:[WILDCARD])
at async Object.testStepSanitizer [WILDCARD]
FAILED ([WILDCARD])
test parallel steps with sanitizers ...
test step 1 ... pending ([WILDCARD])
test step 2 ... FAILED ([WILDCARD])
parallel steps with sanitizers ...
step 1 ... pending ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step while another test step with sanitizers is running.
* parallel steps with sanitizers > step 1
at preValidation ([WILDCARD])
@ -29,9 +29,9 @@ test parallel steps with sanitizers ...
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
at [WILDCARD]
FAILED ([WILDCARD])
test parallel steps when first has sanitizer ...
test step 1 ... pending ([WILDCARD])
test step 2 ... FAILED ([WILDCARD])
parallel steps when first has sanitizer ...
step 1 ... pending ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step while another test step with sanitizers is running.
* parallel steps when first has sanitizer > step 1
at preValidation ([WILDCARD])
@ -39,9 +39,9 @@ test parallel steps when first has sanitizer ...
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
at [WILDCARD]
FAILED ([WILDCARD])
test parallel steps when second has sanitizer ...
test step 1 ... ok ([WILDCARD])
test step 2 ... FAILED ([WILDCARD])
parallel steps when second has sanitizer ...
step 1 ... ok ([WILDCARD])
step 2 ... FAILED ([WILDCARD])
Error: Cannot start test step with sanitizers while another test step is running.
* parallel steps when second has sanitizer > step 1
at preValidation ([WILDCARD])
@ -49,12 +49,12 @@ test parallel steps when second has sanitizer ...
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
at [WILDCARD]
FAILED ([WILDCARD])
test parallel steps where only inner tests have sanitizers ...
test step 1 ...
test step inner ... ok ([WILDCARD])
parallel steps where only inner tests have sanitizers ...
step 1 ...
step inner ... ok ([WILDCARD])
ok ([WILDCARD])
test step 2 ...
test step inner ... FAILED ([WILDCARD])
step 2 ...
step inner ... FAILED ([WILDCARD])
Error: Cannot start test step with sanitizers while another test step is running.
* parallel steps where only inner tests have sanitizers > step 1
at preValidation ([WILDCARD])
@ -65,40 +65,41 @@ FAILED ([WILDCARD])
failures:
capturing
test/steps/invalid_usage.ts > capturing
Error: Cannot run test step after parent scope has finished execution. Ensure any `.step(...)` calls are executed before their parent scope completes execution.
at TestContext.step ([WILDCARD])
at [WILDCARD]/invalid_usage.ts:[WILDCARD]
at [WILDCARD]
top level missing await
test/steps/invalid_usage.ts > top level missing await
Error: There were still test steps running after the current scope finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
at postValidation [WILDCARD]
at testStepSanitizer ([WILDCARD])
[WILDCARD]
inner missing await
test/steps/invalid_usage.ts > inner missing await
Error: 1 test step failed.
at [WILDCARD]
parallel steps with sanitizers
test/steps/invalid_usage.ts > parallel steps with sanitizers
Error: There were still test steps running after the current scope finished execution. Ensure all steps are awaited (ex. `await t.step(...)`).
at postValidation [WILDCARD]
at testStepSanitizer ([WILDCARD])
[WILDCARD]
parallel steps when first has sanitizer
test/steps/invalid_usage.ts > parallel steps when first has sanitizer
Error: 1 test step failed.
at runTest ([WILDCARD])
at [WILDCARD]
parallel steps when second has sanitizer
test/steps/invalid_usage.ts > parallel steps when second has sanitizer
Error: 1 test step failed.
at runTest ([WILDCARD])
at [WILDCARD]
failures:
test/steps/invalid_usage.ts
capturing
top level missing await
inner missing await

View file

@ -1,38 +1,38 @@
[WILDCARD]
running 5 tests from [WILDCARD]
test description ...
test step 1 ...
test inner 1 ... ok ([WILDCARD]ms)
test inner 2 ... ok ([WILDCARD]ms)
running 5 tests from test/steps/passing_steps.ts
description ...
step 1 ...
inner 1 ... ok ([WILDCARD]ms)
inner 2 ... ok ([WILDCARD]ms)
ok ([WILDCARD]ms)
ok ([WILDCARD]ms)
test parallel steps without sanitizers ...
test step 1 ... ok ([WILDCARD])
test step 2 ... ok ([WILDCARD])
parallel steps without sanitizers ...
step 1 ... ok ([WILDCARD])
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
test parallel steps without sanitizers due to parent ...
test step 1 ... ok ([WILDCARD])
test step 2 ... ok ([WILDCARD])
parallel steps without sanitizers due to parent ...
step 1 ... ok ([WILDCARD])
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
test steps with disabled sanitizers, then enabled, then parallel disabled ...
test step 1 ...
test step 1 ...
test step 1 ...
test step 1 ... ok ([WILDCARD])
test step 1 ... ok ([WILDCARD])
steps with disabled sanitizers, then enabled, then parallel disabled ...
step 1 ...
step 1 ...
step 1 ...
step 1 ... ok ([WILDCARD])
step 1 ... ok ([WILDCARD])
ok ([WILDCARD])
test step 2 ... ok ([WILDCARD])
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
ok ([WILDCARD])
ok ([WILDCARD])
test steps buffered then streaming reporting ...
test step 1 ...
test step 1 - 1 ... ok ([WILDCARD])
test step 1 - 2 ...
test step 1 - 2 - 1 ... ok ([WILDCARD])
steps buffered then streaming reporting ...
step 1 ...
step 1 - 1 ... ok ([WILDCARD])
step 1 - 2 ...
step 1 - 2 - 1 ... ok ([WILDCARD])
ok ([WILDCARD])
ok ([WILDCARD])
test step 2 ... ok ([WILDCARD])
step 2 ... ok ([WILDCARD])
ok ([WILDCARD])
test result: ok. 5 passed (18 steps); 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]

View file

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

View file

@ -35,6 +35,7 @@ use deno_core::futures::stream;
use deno_core::futures::FutureExt;
use deno_core::futures::StreamExt;
use deno_core::serde_json::json;
use deno_core::url::Url;
use deno_core::ModuleSpecifier;
use deno_graph::ModuleKind;
use deno_runtime::permissions::Permissions;
@ -45,6 +46,7 @@ use rand::seq::SliceRandom;
use rand::SeedableRng;
use regex::Regex;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::io::Write;
@ -218,6 +220,7 @@ struct PrettyTestReporter {
echo_output: bool,
deferred_step_output: HashMap<TestDescription, Vec<DeferredStepOutput>>,
last_wait_output_level: usize,
cwd: Url,
}
impl PrettyTestReporter {
@ -227,25 +230,31 @@ impl PrettyTestReporter {
echo_output,
deferred_step_output: HashMap::new(),
last_wait_output_level: 0,
cwd: Url::from_directory_path(std::env::current_dir().unwrap()).unwrap(),
}
}
fn force_report_wait(&mut self, description: &TestDescription) {
print!("test {} ...", description.name);
print!("{} ...", description.name);
// flush for faster feedback when line buffered
std::io::stdout().flush().unwrap();
self.last_wait_output_level = 0;
}
fn to_relative_path_or_remote_url(&self, path_or_url: &str) -> String {
let url = Url::parse(path_or_url).unwrap();
if url.scheme() == "file" {
self.cwd.make_relative(&url).unwrap()
} else {
path_or_url.to_string()
}
}
fn force_report_step_wait(&mut self, description: &TestStepDescription) {
if self.last_wait_output_level < description.level {
println!();
}
print!(
"{}test {} ...",
" ".repeat(description.level),
description.name
);
print!("{}{} ...", " ".repeat(description.level), description.name);
// flush for faster feedback when line buffered
std::io::stdout().flush().unwrap();
self.last_wait_output_level = description.level;
@ -287,7 +296,15 @@ impl PrettyTestReporter {
impl TestReporter for PrettyTestReporter {
fn report_plan(&mut self, plan: &TestPlan) {
let inflection = if plan.total == 1 { "test" } else { "tests" };
println!("running {} {} from {}", plan.total, inflection, plan.origin);
println!(
"{}",
colors::gray(format!(
"running {} {} from {}",
plan.total,
inflection,
self.to_relative_path_or_remote_url(&plan.origin)
))
);
}
fn report_wait(&mut self, description: &TestDescription) {
@ -388,14 +405,36 @@ impl TestReporter for PrettyTestReporter {
if !summary.failures.is_empty() {
println!("\nfailures:\n");
for (description, error) in &summary.failures {
println!("{}", description.name);
println!(
"{} {} {}",
colors::gray(
self.to_relative_path_or_remote_url(&description.origin)
),
colors::gray(">"),
description.name
);
println!("{}", error);
println!();
}
println!("failures:\n");
let mut grouped_by_origin: BTreeMap<String, Vec<String>> =
BTreeMap::default();
for (description, _) in &summary.failures {
println!("\t{}", description.name);
let test_names = grouped_by_origin
.entry(description.origin.clone())
.or_default();
test_names.push(description.name.clone());
}
println!("failures:\n");
for (origin, test_names) in &grouped_by_origin {
println!(
"\t{}",
colors::gray(self.to_relative_path_or_remote_url(origin))
);
for test_name in test_names {
println!("\t{}", test_name);
}
}
}