Skip to content

Enable detectAsyncLeaks in Vitest tests#7616

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/enable-detect-async-leaks
Draft

Enable detectAsyncLeaks in Vitest tests#7616
Copilot wants to merge 3 commits intomainfrom
copilot/enable-detect-async-leaks

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Enables detectAsyncLeaks: true in all node-environment Vitest configurations to detect asynchronous resource leaks (e.g., uncleared timers, pending promises) in node-based test runs. Also upgrades vitest to 4.1.0-beta.6, which is the first version to include TypeScript type support for the detectAsyncLeaks option.

Changelog

New

  • detectAsyncLeaks: true added to all node-environment vitest configs:
    • packages/react/vitest.config.mts
    • packages/doc-gen/vitest.config.mts
    • packages/styled-react/vitest.config.ts
    • packages/postcss-preset-primer/vitest.config.ts

Changed

  • Upgraded vitest, @vitest/browser, and @vitest/browser-playwright from ^4.0.15 to ^4.1.0-beta.6 to support the detectAsyncLeaks TypeScript type in InlineConfig

Removed

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Config-only change with a vitest dev-dependency bump. No public API impact.

Testing & Reviewing

Browser-based vitest configs (vitest.config.browser.mts, vitest.config.browser.ts) are intentionally excluded — detectAsyncLeaks uses Node.js async_hooks and is not applicable to Chromium/Playwright environments.

Merge checklist


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@changeset-bot
Copy link

changeset-bot bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: b9ab414

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
@github-actions github-actions bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Mar 3, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Or, apply the integration-tests: skipped manually label to skip these checks.

@siddharthkp
Copy link
Member

@copilot Can you see the CI / type-check error and fix it?

Co-authored-by: siddharthkp <1863771+siddharthkp@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Mar 5, 2026

@copilot Can you see the CI / type-check error and fix it?

Fixed in b9ab414. The detectAsyncLeaks option was added in vitest 4.1.0-beta.4, but the project was on 4.0.15. The type-check in postcss-preset-primer failed because detectAsyncLeaks didn't exist in InlineConfig. I upgraded vitest, @vitest/browser, and @vitest/browser-playwright from ^4.0.15 to ^4.1.0-beta.6.

Copilot AI changed the title [WIP] Enable detectAsyncLeaks in Vitest tests Enable detectAsyncLeaks in Vitest tests Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants