From 12360d84ffef6ca95214e1a86bc6da984c32dbac Mon Sep 17 00:00:00 2001 From: nyrax <234825343+HttpGetBinary@users.noreply.github.com> Date: Wed, 22 Apr 2026 00:08:00 +0200 Subject: [PATCH] test_runner: add [Symbol.dispose] to mock Timeout class The mock Timeout returned by MockTimers did not implement [Symbol.dispose], making it incompatible with the `using` keyword. The real Timeout has this method. This fix adds it, calling globalThis.clearTimeout(this) which routes through the mock's own clearTimeout when mocks are active. Fixes: https://github.com/nodejs/node/issues/62815 --- lib/internal/test_runner/mock/mock_timers.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/test_runner/mock/mock_timers.js b/lib/internal/test_runner/mock/mock_timers.js index 643128c3f0031f..69f62357b0d7bf 100644 --- a/lib/internal/test_runner/mock/mock_timers.js +++ b/lib/internal/test_runner/mock/mock_timers.js @@ -92,6 +92,10 @@ class Timeout { refresh() { return this; } + + [SymbolDispose]() { + globalThis.clearTimeout(this); + } } class MockTimers {