From fe86a64c6c6aa75481bffe5880b5c4e35ea67927 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Thu, 15 Oct 2026 12:41:30 +0200 Subject: [PATCH] fix: skip builtin loading in async leak detector (#11598) --- packages/vitest/src/runtime/detect-async-leaks.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/vitest/src/runtime/detect-async-leaks.ts b/packages/vitest/src/runtime/detect-async-leaks.ts index c0bdc4bd3..c291edabb 100644 --- a/packages/vitest/src/runtime/detect-async-leaks.ts +++ b/packages/vitest/src/runtime/detect-async-leaks.ts @@ -47,6 +47,11 @@ export function detectAsyncLeaks( Error.stackTraceLimit = limit } + // a builtin loaded on first use can create pending promises at the module level + if (stack.includes('node:internal/bootstrap/realm')) { + return + } + if (!stack.includes(testFile)) { const trigger = resources.get(triggerAsyncId) -- 2.54.0