Skip to content

fix(vitest): discover named config files - #36471

Open
harshmathurx wants to merge 1 commit into
nrwl:masterfrom
harshmathurx:fix/vitest-multiple-project-configs
Open

fix(vitest): discover named config files#36471
harshmathurx wants to merge 1 commit into
nrwl:masterfrom
harshmathurx:fix/vitest-multiple-project-configs

Conversation

@harshmathurx

@harshmathurx harshmathurx commented Jul 27, 2026

Copy link
Copy Markdown

Current Behavior

The @nx/vitest inferred plugin only discovers vite.config.* and vitest.config.* files. That misses valid Vitest 4 migration patterns where one Nx project has multiple named Vitest configs such as vitest.unit.config.ts and vitest.integration.config.ts for different test groups.

Expected Behavior

Nx should discover named Vite/Vitest config files for the Vitest inferred plugin, so a workspace can expose separate targets/includes/excludes from the same Nx project without falling back to manual target wiring.

Related Issue(s)

Fixes #36438

This PR

Root cause: the discovery glob was restricted to the canonical vite.config.* / vitest.config.* filenames, so named config files were invisible before plugin target inference ran.

The fix is intentionally small:

  • relax the Vitest config discovery glob to include named Vite/Vitest config files
  • add a focused assertion covering the expanded glob behavior

Validation

Local checks run:

  • git diff --check
  • node glob intent smoke check for vitest.unit.config.ts, vitest.integration.config.mts, and standard vitest.config.ts

Local full dependency install was blocked by disk space in this checkout:

  • pnpm install --frozen-lockfile failed with ERR_PNPM_ENOSPC
  • NODE_OPTIONS=--max-old-space-size=4096 pnpm install --filter @nx/vitest --frozen-lockfile --ignore-scripts also failed with ERR_PNPM_ENOSPC

CI evidence currently visible on the PR:

  • Socket Security: Project Report passed
  • Socket Security: Pull Request Alerts passed
  • Netlify deploys are pending maintainer approval

Risk / compatibility

This only broadens discovery to additional existing config-file names. Standard vite.config.* and vitest.config.* projects keep the same behavior; the main risk is surfacing additional Vitest targets that users intentionally named but Nx previously skipped.

cc @FrozenPandaz for the @nx/vitest inferred-plugin path.

@harshmathurx
harshmathurx requested a review from a team as a code owner July 27, 2026 05:50
@harshmathurx
harshmathurx requested a review from AgentEnder July 27, 2026 05:50
@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

👷 Deploy request for nx-docs pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 74951dc

@netlify

netlify Bot commented Jul 27, 2026

Copy link
Copy Markdown

👷 Deploy request for nx-dev pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 74951dc

@harshmathurx

Copy link
Copy Markdown
Author

@FrozenPandaz could you take a look when you get a chance? This is the small @nx/vitest plugin discovery glob fix for #36438, matching the recent Vitest 4 workspace-config migration direction.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restore support for multiple Vitest projects per Nx project

1 participant