mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
fix(runtime/testing): false positive for timers when an error is thrown (#9553)
This commit is contained in:
parent
b47f9cee8c
commit
eefd522f04
4 changed files with 48 additions and 5 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue