diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/test_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/testdata/error_007_any.ts | 2 | ||||
-rw-r--r-- | cli/tests/testdata/error_007_any.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/error_cause.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/test/non_error_thrown.out | 40 | ||||
-rw-r--r-- | cli/tests/testdata/test/non_error_thrown.ts | 23 | ||||
-rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_missing_details.out | 5 | ||||
-rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out | 12 | ||||
-rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests_no_trace.out | 10 | ||||
-rw-r--r-- | cli/tests/testdata/test/ops_sanitizer_unstable.out | 6 |
10 files changed, 93 insertions, 15 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 3a7e71090..c63ee6e5a 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -387,3 +387,9 @@ itest!(check_local_by_default2 { http_server: true, exit_code: 1, }); + +itest!(non_error_thrown { + args: "test --quiet test/non_error_thrown.ts", + output: "test/non_error_thrown.out", + exit_code: 1, +}); diff --git a/cli/tests/testdata/error_007_any.ts b/cli/tests/testdata/error_007_any.ts index 778886fcb..bfef1289b 100644 --- a/cli/tests/testdata/error_007_any.ts +++ b/cli/tests/testdata/error_007_any.ts @@ -1 +1 @@ -throw {}; +throw { foo: "bar" }; diff --git a/cli/tests/testdata/error_007_any.ts.out b/cli/tests/testdata/error_007_any.ts.out index 45dbffd04..b93ceb1d0 100644 --- a/cli/tests/testdata/error_007_any.ts.out +++ b/cli/tests/testdata/error_007_any.ts.out @@ -1 +1 @@ -[WILDCARD]error: Uncaught #<Object> +[WILDCARD]error: Uncaught { foo: "bar" } diff --git a/cli/tests/testdata/error_cause.ts.out b/cli/tests/testdata/error_cause.ts.out index 512ab4326..2aab020d9 100644 --- a/cli/tests/testdata/error_cause.ts.out +++ b/cli/tests/testdata/error_cause.ts.out @@ -11,5 +11,5 @@ Caused by: Error: bar at b (file:///[WILDCARD]/error_cause.ts:7:3) at c (file:///[WILDCARD]/error_cause.ts:11:3) at file:///[WILDCARD]/error_cause.ts:14:1 -Caused by: deno +Caused by: "deno" [WILDCARD] diff --git a/cli/tests/testdata/test/non_error_thrown.out b/cli/tests/testdata/test/non_error_thrown.out new file mode 100644 index 000000000..922129e29 --- /dev/null +++ b/cli/tests/testdata/test/non_error_thrown.out @@ -0,0 +1,40 @@ +running 6 tests from [WILDCARD]/non_error_thrown.ts +foo ... FAILED ([WILDCARD]) +bar ... FAILED ([WILDCARD]) +baz ... FAILED ([WILDCARD]) +qux ... FAILED ([WILDCARD]) +quux ... FAILED ([WILDCARD]) +quuz ... FAILED ([WILDCARD]) + + ERRORS + +foo => [WILDCARD]/non_error_thrown.ts:1:6 +error: undefined + +bar => [WILDCARD]/non_error_thrown.ts:5:6 +error: null + +baz => [WILDCARD]/non_error_thrown.ts:9:6 +error: 123 + +qux => [WILDCARD]/non_error_thrown.ts:13:6 +error: "Hello, world!" + +quux => [WILDCARD]/non_error_thrown.ts:17:6 +error: [ 1, 2, 3 ] + +quuz => [WILDCARD]/non_error_thrown.ts:21:6 +error: { a: "Hello, world!", b: [ 1, 2, 3 ] } + + FAILURES + +foo => [WILDCARD]/non_error_thrown.ts:1:6 +bar => [WILDCARD]/non_error_thrown.ts:5:6 +baz => [WILDCARD]/non_error_thrown.ts:9: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]) + +error: Test failed diff --git a/cli/tests/testdata/test/non_error_thrown.ts b/cli/tests/testdata/test/non_error_thrown.ts new file mode 100644 index 000000000..85dc8d179 --- /dev/null +++ b/cli/tests/testdata/test/non_error_thrown.ts @@ -0,0 +1,23 @@ +Deno.test("foo", () => { + throw undefined; +}); + +Deno.test("bar", () => { + throw null; +}); + +Deno.test("baz", () => { + throw 123; +}); + +Deno.test("qux", () => { + throw "Hello, world!"; +}); + +Deno.test("quux", () => { + throw [1, 2, 3]; +}); + +Deno.test("quuz", () => { + throw { a: "Hello, world!", b: [1, 2, 3] }; +}); diff --git a/cli/tests/testdata/test/ops_sanitizer_missing_details.out b/cli/tests/testdata/test/ops_sanitizer_missing_details.out index 58d656012..5d1eb55df 100644 --- a/cli/tests/testdata/test/ops_sanitizer_missing_details.out +++ b/cli/tests/testdata/test/ops_sanitizer_missing_details.out @@ -5,11 +5,12 @@ test 1 ... FAILED [WILDCARD] ERRORS test 1 => ./test/ops_sanitizer_missing_details.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: Test case is leaking async ops. -- 1 async operation to op_write was started in this test, but never completed. + - 1 async operation to op_write was started in this test, but never completed. To get more details where ops were leaked, run again with --trace-ops flag. + at [WILDCARD] FAILURES 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 bb9229c02..ce30ea1a6 100644 --- a/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out +++ b/cli/tests/testdata/test/ops_sanitizer_multiple_timeout_tests.out @@ -6,9 +6,9 @@ test 2 ... FAILED ([WILDCARD]) ERRORS test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: 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: + - 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: at [WILDCARD] at setTimeout ([WILDCARD]) at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3) @@ -21,10 +21,12 @@ error: Test case is leaking async ops. at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:8:27 at [WILDCARD] + at [WILDCARD] + test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: 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: + - 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: at [WILDCARD] at setTimeout ([WILDCARD]) at test ([WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:4:3) @@ -37,6 +39,8 @@ error: Test case is leaking async ops. at [WILDCARD]/testdata/test/ops_sanitizer_multiple_timeout_tests.ts:10:27 at [WILDCARD] + at [WILDCARD] + FAILURES test 1 => ./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 7b2dc168b..305f92aba 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 @@ -6,18 +6,20 @@ test 2 ... FAILED ([WILDCARD]) ERRORS test 1 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: 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. + - 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. + at [WILDCARD] test 2 => ./test/ops_sanitizer_multiple_timeout_tests.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: 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. + - 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. + at [WILDCARD] FAILURES diff --git a/cli/tests/testdata/test/ops_sanitizer_unstable.out b/cli/tests/testdata/test/ops_sanitizer_unstable.out index 8be4e4551..47ca57865 100644 --- a/cli/tests/testdata/test/ops_sanitizer_unstable.out +++ b/cli/tests/testdata/test/ops_sanitizer_unstable.out @@ -6,14 +6,16 @@ leak interval ... FAILED ([WILDCARD]) ERRORS leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD] -error: Test case is leaking async ops. +error: AssertionError: 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: + - 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: at [WILDCARD] at setInterval ([WILDCARD]) at [WILDCARD]/testdata/test/ops_sanitizer_unstable.ts:3:3 at [WILDCARD] + at [WILDCARD] + FAILURES leak interval => ./test/ops_sanitizer_unstable.ts:[WILDCARD] |