summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
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.