diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/test_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/testdata/compat/test_runner/top_level_fail_cjs.out | 20 | ||||
-rw-r--r-- | cli/tests/testdata/compat/test_runner/top_level_fail_esm.out | 20 | ||||
-rw-r--r-- | cli/tests/testdata/test/no_check.out | 17 | ||||
-rw-r--r-- | cli/tests/testdata/test/uncaught_errors.out | 58 | ||||
-rw-r--r-- | cli/tests/testdata/test/uncaught_errors_1.ts | 9 | ||||
-rw-r--r-- | cli/tests/testdata/test/uncaught_errors_2.ts | 8 | ||||
-rw-r--r-- | cli/tests/testdata/test/uncaught_errors_3.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/test/unhandled_rejection.out | 16 |
9 files changed, 144 insertions, 11 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 0cbc3130f..05a663215 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -368,3 +368,9 @@ fn file_protocol() { }) .run(); } + +itest!(uncaught_errors { + args: "test --quiet test/uncaught_errors_1.ts test/uncaught_errors_2.ts test/uncaught_errors_3.ts", + output: "test/uncaught_errors.out", + exit_code: 1, +}); diff --git a/cli/tests/testdata/compat/test_runner/top_level_fail_cjs.out b/cli/tests/testdata/compat/test_runner/top_level_fail_cjs.out index 2d1471d63..be3c1b93b 100644 --- a/cli/tests/testdata/compat/test_runner/top_level_fail_cjs.out +++ b/cli/tests/testdata/compat/test_runner/top_level_fail_cjs.out @@ -1,7 +1,9 @@ +Uncaught error from ./compat/test_runner/top_level_fail_cjs.js FAILED -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + ERRORS -error: Uncaught (in promise) AssertionError: Values are not strictly equal: +./compat/test_runner/top_level_fail_cjs.js (uncaught error) +error: (in promise) AssertionError: Values are not strictly equal: [Diff] Actual / Expected @@ -10,4 +12,16 @@ error: Uncaught (in promise) AssertionError: Values are not strictly equal: - 10 + 20 -[WILDCARD]
\ No newline at end of file + Error.captureStackTrace(this, stackStartFn || stackStartFunction); + ^ + at [WILDCARD] +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + + FAILURES + +./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]) + +error: Test failed diff --git a/cli/tests/testdata/compat/test_runner/top_level_fail_esm.out b/cli/tests/testdata/compat/test_runner/top_level_fail_esm.out index 04baeec2b..b4b313208 100644 --- a/cli/tests/testdata/compat/test_runner/top_level_fail_esm.out +++ b/cli/tests/testdata/compat/test_runner/top_level_fail_esm.out @@ -1,7 +1,9 @@ +Uncaught error from ./compat/test_runner/top_level_fail_esm.mjs FAILED -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + ERRORS -error: Uncaught AssertionError: Values are not strictly equal: +./compat/test_runner/top_level_fail_esm.mjs (uncaught error) +error: AssertionError: Values are not strictly equal: [Diff] Actual / Expected @@ -10,4 +12,16 @@ error: Uncaught AssertionError: Values are not strictly equal: - 10 + 20 -[WILDCARD]
\ No newline at end of file + Error.captureStackTrace(this, stackStartFn || stackStartFunction); + ^ + at [WILDCARD] +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + + FAILURES + +./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]) + +error: Test failed diff --git a/cli/tests/testdata/test/no_check.out b/cli/tests/testdata/test/no_check.out index 9daab7ac4..3e1c93535 100644 --- a/cli/tests/testdata/test/no_check.out +++ b/cli/tests/testdata/test/no_check.out @@ -1,8 +1,19 @@ +Uncaught error from ./test/no_check.ts FAILED -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + ERRORS -error: Uncaught TypeError: Cannot read properties of undefined (reading 'fn') +./test/no_check.ts (uncaught error) +error: TypeError: Cannot read properties of undefined (reading 'fn') Deno.test(); ^ - at [WILDCARD] at [WILDCARD]/test/no_check.ts:1:6 +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + + FAILURES + +./test/no_check.ts (uncaught error) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed diff --git a/cli/tests/testdata/test/uncaught_errors.out b/cli/tests/testdata/test/uncaught_errors.out new file mode 100644 index 000000000..1ff709d43 --- /dev/null +++ b/cli/tests/testdata/test/uncaught_errors.out @@ -0,0 +1,58 @@ +running 3 tests from ./test/uncaught_errors_1.ts +foo 1 ... FAILED ([WILDCARD]) +foo 2 ... ok ([WILDCARD]) +foo 3 ... +Uncaught error from ./test/uncaught_errors_1.ts FAILED +running 3 tests from ./test/uncaught_errors_2.ts +bar 1 ... ok ([WILDCARD]) +bar 2 ... FAILED ([WILDCARD]) +bar 3 ... FAILED ([WILDCARD]) +Uncaught error from ./test/uncaught_errors_3.ts FAILED + + ERRORS + +foo 1 => ./test/uncaught_errors_1.ts:1:6 +error: Error: foo 1 message + throw new Error("foo 1 message"); + ^ + at [WILDCARD]/test/uncaught_errors_1.ts:2:9 + +./test/uncaught_errors_1.ts (uncaught error) +error: (in promise) Error: foo 3 message + Promise.reject(new Error("foo 3 message")); + ^ + at [WILDCARD]/test/uncaught_errors_1.ts:8:18 +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + +bar 2 => ./test/uncaught_errors_2.ts:3:6 +error: Error: bar 2 + throw new Error("bar 2"); + ^ + at [WILDCARD]/test/uncaught_errors_2.ts:4:9 + +bar 3 => ./test/uncaught_errors_2.ts:6:6 +error: Error: bar 3 message + throw new Error("bar 3 message"); + ^ + at [WILDCARD]/test/uncaught_errors_2.ts:7:9 + +./test/uncaught_errors_3.ts (uncaught error) +error: Error: baz +throw new Error("baz"); + ^ + at [WILDCARD]/test/uncaught_errors_3.ts:1:7 +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + + FAILURES + +foo 1 => ./test/uncaught_errors_1.ts:1:6 +./test/uncaught_errors_1.ts (uncaught error) +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]) + +error: Test failed diff --git a/cli/tests/testdata/test/uncaught_errors_1.ts b/cli/tests/testdata/test/uncaught_errors_1.ts new file mode 100644 index 000000000..166b23ac3 --- /dev/null +++ b/cli/tests/testdata/test/uncaught_errors_1.ts @@ -0,0 +1,9 @@ +Deno.test("foo 1", () => { + throw new Error("foo 1 message"); +}); + +Deno.test("foo 2", () => {}); + +Deno.test("foo 3", () => { + Promise.reject(new Error("foo 3 message")); +}); diff --git a/cli/tests/testdata/test/uncaught_errors_2.ts b/cli/tests/testdata/test/uncaught_errors_2.ts new file mode 100644 index 000000000..8cafbe291 --- /dev/null +++ b/cli/tests/testdata/test/uncaught_errors_2.ts @@ -0,0 +1,8 @@ +Deno.test("bar 1", () => {}); + +Deno.test("bar 2", () => { + throw new Error("bar 2"); +}); +Deno.test("bar 3", () => { + throw new Error("bar 3 message"); +}); diff --git a/cli/tests/testdata/test/uncaught_errors_3.ts b/cli/tests/testdata/test/uncaught_errors_3.ts new file mode 100644 index 000000000..cb2a55036 --- /dev/null +++ b/cli/tests/testdata/test/uncaught_errors_3.ts @@ -0,0 +1 @@ +throw new Error("baz"); diff --git a/cli/tests/testdata/test/unhandled_rejection.out b/cli/tests/testdata/test/unhandled_rejection.out index fae353a28..50b0ad6ab 100644 --- a/cli/tests/testdata/test/unhandled_rejection.out +++ b/cli/tests/testdata/test/unhandled_rejection.out @@ -1,10 +1,22 @@ Check [WILDCARD]/test/unhandled_rejection.ts +Uncaught error from ./test/unhandled_rejection.ts FAILED -test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + ERRORS -error: Uncaught (in promise) Error: rejection +./test/unhandled_rejection.ts (uncaught error) +error: (in promise) Error: rejection reject(new Error("rejection")); ^ at [WILDCARD]/test/unhandled_rejection.ts:2:10 at new Promise (<anonymous>) at [WILDCARD]/test/unhandled_rejection.ts:1:1 +This error was not caught from a test and caused the test runner to fail on the referenced module. +It most likely originated from a dangling promise, event/timeout handler or top-level code. + + FAILURES + +./test/unhandled_rejection.ts (uncaught error) + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +error: Test failed |