Skip to content

Conversation

@DeveloperViraj
Copy link

@DeveloperViraj DeveloperViraj commented Nov 5, 2025

Fixes: #60509

AbortSignal.timeout() previously used internal/timers.setTimeout, which was not intercepted by mock.timers.enable().

This change updates it to use globalThis.setTimeout and globalThis.clearTimeout, so mock.timers.tick() correctly triggers aborts.


/cc @nodejs/testing

Notes for reviewers

This change replaces require('internal/timers') usage with global timers,
so mock.timers in the Node test runner can intercept AbortSignal.timeout.

Verified locally that the fix aligns with issue reproduction steps.

@nodejs-github-bot nodejs-github-bot added the needs-ci PRs that need a full CI run. label Nov 5, 2025
Copy link
Contributor

@Renegade334 Renegade334 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The DOM standard does not use setTimeout for this method, and changes to the public-facing timers API should not be observable here.

The correct route would probably be to add this as a discrete API target for the mocker (ie. enabled via mocks.timers.enable({ apis: ['AbortSignal.timeout'] })) with its own implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mock.timers ignores AbortSignal.timeout

4 participants