summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-02-22 00:21:25 +0800
committerGitHub <noreply@github.com>2021-02-21 17:21:25 +0100
commiteefd522f0490f9bb829de9342dcd1ed7aeacb42a (patch)
treebd0663e192a69c911dcb1b24f766b7ce4e99f656 /runtime/js
parentb47f9cee8cceabb3784259dd260bc5e633446b04 (diff)
fix(runtime/testing): false positive for timers when an error is thrown (#9553)
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/40_testing.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/js/40_testing.js b/runtime/js/40_testing.js
index 15545fc49..2258dc7b6 100644
--- a/runtime/js/40_testing.js
+++ b/runtime/js/40_testing.js
@@ -34,11 +34,14 @@
function assertOps(fn) {
return async function asyncOpSanitizer() {
const pre = metrics();
- await fn();
- // Defer until next event loop turn - that way timeouts and intervals
- // cleared can actually be removed from resource table, otherwise
- // false positives may occur (https://github.com/denoland/deno/issues/4591)
- await delay(0);
+ try {
+ await fn();
+ } finally {
+ // Defer until next event loop turn - that way timeouts and intervals
+ // cleared can actually be removed from resource table, otherwise
+ // false positives may occur (https://github.com/denoland/deno/issues/4591)
+ await delay(0);
+ }
const post = metrics();
// We're checking diff because one might spawn HTTP server in the background
// that will be a pending async op before test starts.