From d335343a79afbcfe719109af510fe7a1dd0df2e8 Mon Sep 17 00:00:00 2001 From: Andreu Botella Date: Sun, 28 Nov 2021 16:40:38 +0100 Subject: fix(test): Improve reliability of `deno test`'s op sanitizer with timers (#12908) Although not easy to replicate in the wild, the `deno test` op sanitizer can fail when there are intervals that started before a test runs, since the op sanitizer can end up running in the time between the timer op for an interval's run resolves and the op for the next run starts. This change fixes that by adding a new macrotask callback that will run after the timer macrotask queue has drained. This ensures that there is a timer op if there are any timers which are unresolved by the time the op sanitizer runs. --- cli/tests/integration/test_tests.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/tests/integration/test_tests.rs') diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 3f23efca2..07c1b6c7d 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -151,6 +151,11 @@ itest!(ops_sanitizer_unstable { output: "test/ops_sanitizer_unstable.out", }); +itest!(ops_sanitizer_timeout_failure { + args: "test test/ops_sanitizer_timeout_failure.ts", + output: "test/ops_sanitizer_timeout_failure.out", +}); + itest!(exit_sanitizer { args: "test test/exit_sanitizer.ts", output: "test/exit_sanitizer.out", -- cgit v1.2.3