Skip to content

Enable detectAsyncLeaks in Vitest tests#7616

Merged
siddharthkp merged 5 commits into
mainfrom
copilot/enable-detect-async-leaks
May 11, 2026
Merged

Enable detectAsyncLeaks in Vitest tests#7616
siddharthkp merged 5 commits into
mainfrom
copilot/enable-detect-async-leaks

Conversation

Copy link
Copy Markdown
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.5 (stable release), which includes 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.5 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
Copy Markdown

changeset-bot Bot commented Mar 3, 2026

⚠️ No Changeset found

Latest commit: 5c7be71

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 4, 2026

Hi! This pull request has been marked as stale because it has been open with no activity for 60 days. You can comment on the pull request or remove the stale label to keep it open. If you do nothing, this pull request will be closed in 7 days.

@github-actions github-actions Bot added the Stale label May 4, 2026
@siddharthkp
Copy link
Copy Markdown
Member

@copilot resolve the merge conflicts in this pull request

…-async-leaks

# Conflicts:
#	package-lock.json
#	package.json

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

Copilot AI commented May 4, 2026

@copilot resolve the merge conflicts in this pull request

Resolved in 572f65c. The conflicts were in package.json and package-lock.json — I merged with origin/main and resolved by taking the newer stable versions (vitest ^4.1.5, typescript-eslint ^8.57.0, etc.) from main. The detectAsyncLeaks: true additions in all node-environment vitest configs are preserved.

@francinelucca francinelucca added the skip changeset This change does not need a changelog label May 8, 2026
@siddharthkp siddharthkp added integration-tests: skipped manually Changes in this PR do not require an integration test and removed integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm labels May 11, 2026
@siddharthkp siddharthkp marked this pull request as ready for review May 11, 2026 09:06
@siddharthkp siddharthkp requested a review from a team as a code owner May 11, 2026 09:06
Copilot AI review requested due to automatic review settings May 11, 2026 09:06
@siddharthkp siddharthkp enabled auto-merge May 11, 2026 09:06
@siddharthkp siddharthkp added this pull request to the merge queue May 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Enables Vitest’s detectAsyncLeaks: true across all Node-environment Vitest configurations in the monorepo to help catch asynchronous resource leaks (e.g., uncleared timers / pending async work) during Node-based test runs.

Changes:

  • Added detectAsyncLeaks: true to the Node test config in @primer/react.
  • Added detectAsyncLeaks: true to the Node test config in @primer/styled-react.
  • Added detectAsyncLeaks: true to the Node test config in @primer/doc-gen and @primer/postcss-preset-primer.
Show a summary per file
File Description
packages/react/vitest.config.mts Enables async leak detection for the node-environment test suite.
packages/styled-react/vitest.config.ts Enables async leak detection for the node-environment test suite.
packages/doc-gen/vitest.config.mts Enables async leak detection for node-environment tests.
packages/postcss-preset-primer/vitest.config.ts Enables async leak detection for node-environment tests.

Copilot's findings

  • Files reviewed: 4/4 changed files
  • Comments generated: 0

Merged via the queue into main with commit 28a09ba May 11, 2026
71 of 72 checks passed
@siddharthkp siddharthkp deleted the copilot/enable-detect-async-leaks branch May 11, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration-tests: skipped manually Changes in this PR do not require an integration test skip changeset This change does not need a changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants