You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_runner: align MockTimers timeout API - #62820
Align MockTimers timeout handles with the public Timeout API by exposing close() and [Symbol.dispose]() on fake setTimeout() results.
Problem
When test.mock.timers.enable() is active, setTimeout() returns a mock timeout handle that does not implement Timeout.close() or Timeout[Symbol.dispose](). That breaks disposal-based patterns such as DisposableStack.use(timeout).
Root cause
MockTimers used its own Timeout wrapper with only ref(), unref(), refresh(), and hasRef(), so the fake timeout handle diverged from the documented timeout API.
Summary
Align MockTimers timeout handles with the public Timeout API by exposing
close()and[Symbol.dispose]()on fakesetTimeout()results.Problem
When
test.mock.timers.enable()is active,setTimeout()returns a mock timeout handle that does not implementTimeout.close()orTimeout[Symbol.dispose](). That breaks disposal-based patterns such asDisposableStack.use(timeout).Root cause
MockTimers used its own
Timeoutwrapper with onlyref(),unref(),refresh(), andhasRef(), so the fake timeout handle diverged from the documented timeout API.Changes