diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-02-22 00:21:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-21 17:21:25 +0100 |
commit | eefd522f0490f9bb829de9342dcd1ed7aeacb42a (patch) | |
tree | bd0663e192a69c911dcb1b24f766b7ce4e99f656 /cli/tests | |
parent | b47f9cee8cceabb3784259dd260bc5e633446b04 (diff) |
fix(runtime/testing): false positive for timers when an error is thrown (#9553)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/test_finally_cleartimeout.out | 23 | ||||
-rw-r--r-- | cli/tests/test_finally_cleartimeout.ts | 11 |
3 files changed, 40 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index cd90315b3..bb65f24fa 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2402,6 +2402,12 @@ mod integration { output: "deno_test.out", }); + itest!(deno_test_finally_cleartimeout { + args: "test test_finally_cleartimeout.ts", + exit_code: 1, + output: "test_finally_cleartimeout.out", + }); + itest!(deno_test_unresolved_promise { args: "test test_unresolved_promise.js", exit_code: 1, diff --git a/cli/tests/test_finally_cleartimeout.out b/cli/tests/test_finally_cleartimeout.out new file mode 100644 index 000000000..c8f412bf0 --- /dev/null +++ b/cli/tests/test_finally_cleartimeout.out @@ -0,0 +1,23 @@ +Check [WILDCARD]/$deno$test.ts +running 2 tests +test error ... FAILED ([WILDCARD]) +test success ... ok ([WILDCARD]) + +failures: + +error +Error: fail + at [WILDCARD]/test_finally_cleartimeout.ts:4:11 + at asyncOpSanitizer (deno:runtime/js/40_testing.js:38:15) + at Object.resourceSanitizer [as fn] (deno:runtime/js/40_testing.js:74:13) + at TestRunner.[Symbol.asyncIterator] (deno:runtime/js/40_testing.js:249:24) + at AsyncGenerator.next (<anonymous>) + at Object.runTests (deno:runtime/js/40_testing.js:326:22) + at async [WILDCARD]/$deno$test.ts:3:1 + +failures: + + error + +test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + diff --git a/cli/tests/test_finally_cleartimeout.ts b/cli/tests/test_finally_cleartimeout.ts new file mode 100644 index 000000000..dcc0a4d64 --- /dev/null +++ b/cli/tests/test_finally_cleartimeout.ts @@ -0,0 +1,11 @@ +Deno.test("error", function () { + const timer = setTimeout(() => null, 10000); + try { + throw new Error("fail"); + } finally { + clearTimeout(timer); + } +}); + +Deno.test("success", function () { +}); |