Skip to content

fix: clamp slowTestThreshold to max 32-bit int for setTimeout#10161

Open
mixelburg wants to merge 1 commit intovitest-dev:mainfrom
mixelburg:fix/slow-threshold-infinity
Open

fix: clamp slowTestThreshold to max 32-bit int for setTimeout#10161
mixelburg wants to merge 1 commit intovitest-dev:mainfrom
mixelburg:fix/slow-threshold-infinity

Conversation

@mixelburg
Copy link
Copy Markdown
Contributor

Fixes #10155

Problem

When slowTestThreshold is set to Infinity (e.g., to suppress slow test warnings), Node.js setTimeout throws a TimeoutOverflowWarning because Infinity exceeds the 32-bit signed integer limit, falling back to 1ms timeout. This causes slow test indicators to flash immediately instead of being suppressed.

Fix

Clamp the slowTestThreshold value to 2_147_483_647 (max 32-bit signed integer) before passing it to setTimeout in both onHookStart and onTestStart methods of the SummaryReporter.

When slowTestThreshold is set to Infinity (or any value exceeding
2^31-1), Node.js setTimeout triggers a TimeoutOverflowWarning and
falls back to 1ms timeout, causing slow test indicators to flash
immediately. Clamp the value to 2_147_483_647 (max 32-bit signed
integer) in both onHookStart and onTestStart methods.

Fixes vitest-dev#10155
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 19, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e5172e6
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/69e4d2beeaeb1e00084e0bb4
😎 Deploy Preview https://deploy-preview-10161--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hi-ogawa hi-ogawa added the maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control label Apr 20, 2026
@github-actions
Copy link
Copy Markdown

Hello @mixelburg. Your PR has been labeled maybe automated because it appears to have been fully generated by AI with no human involvement. It will be closed automatically in 3 days unless a real person responds.

If you're a real person behind this contribution, please:

  • Confirm you've personally reviewed and stand behind its content
  • Make sure it follows our contribution guidelines and uses the correct GitHub template
  • Disclose any AI tools you used (e.g. Claude, Copilot, Codex)

If you believe this was flagged by mistake, leave a comment.

These measures help us reduce maintenance burden and keep the team's work efficient. See our AI contributions policy for more context.

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

Labels

maybe automated User is likely an AI agent, or the content was generated by an AI assistant without user control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

slowTestThreshold: Infinity triggers Node's TimeoutOverflowWarning

2 participants