Skip to content

fix(frontend): exclude nested node_modules from the vitest run#217

Open
codebanditssss wants to merge 1 commit into
mainfrom
fix/vitest-exclude-nested-node-modules
Open

fix(frontend): exclude nested node_modules from the vitest run#217
codebanditssss wants to merge 1 commit into
mainfrom
fix/vitest-exclude-nested-node-modules

Conversation

@codebanditssss

Copy link
Copy Markdown
Collaborator

Closes #216.

Problem

frontend/vite.renderer.config.ts set test.exclude to ["node_modules/**", ...]. Providing exclude replaces vitest's default **/node_modules/** (it doesn't merge), and the root-anchored node_modules/** doesn't match nested node_modules. src/landing is a tracked, self-contained Next.js preview app with its own deps, so once those are installed, npm test collected and ran vendored third-party suites (zod, next, react-medium-image-zoom, style-to-js) → 20+ failures from code that isn't ours.

Change

"node_modules/**""**/node_modules/**" so nested node_modules are excluded at any depth.

Test

  • Before: npm test collected 185 files / 2033 tests with 8 failed files / 20 failed tests, all under src/landing/node_modules/**.
  • After: npm test collects only the renderer's 10 files / 121 tests, all passing, with zero src/landing/node_modules references — and runs in ~6s instead of ~50s.

A bare "node_modules/**" replaces vitest's default "**/node_modules/**"
and only matches the repo root, so the tracked src/landing preview app's
nested node_modules had its vendored third-party test suites (zod, next, ...)
collected and run once those deps were installed — 20+ failures from code
that isn't ours.

Anchor it at any depth with "**/node_modules/**".

Closes #216
@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes a vitest misconfiguration where the test exclude list used a root-anchored node_modules/** glob that silently failed to exclude the nested node_modules trees brought in by the tracked src/landing Next.js preview app, causing 185 vendored third-party test files to be collected and 20+ to fail.

  • Replaces \"node_modules/**\" with \"**/node_modules/**\" in test.exclude, matching the pattern vitest uses in its own default — this is the correct fix for nested node_modules at any directory depth.
  • The remaining entries (dist/**, dist-electron/**, e2e/**) remain root-anchored; these only exist at the project root today, but they would need the same treatment if subdirectories ever contain their own dist or e2e folders.

Confidence Score: 5/5

Safe to merge — single-line glob fix in test config with no impact on build or runtime behaviour.

The change is a one-line correction to a glob pattern in the vitest exclude list. It aligns the project's explicit pattern with vitest's own default, is fully explained in the added comment and PR description, and the before/after test counts confirm the intended effect.

No files require special attention.

Important Files Changed

Filename Overview
frontend/vite.renderer.config.ts Changed test.exclude pattern from root-anchored "node_modules/" to depth-agnostic "/node_modules/**" so vendored suites inside src/landing/node_modules are no longer collected by vitest.

Reviews (1): Last reviewed commit: "fix(frontend): exclude nested node_modul..." | Re-trigger Greptile

@codebanditssss codebanditssss requested a review from yyovil June 12, 2026 21:02
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.

vitest exclude misses nested node_modules (src/landing) — runs vendored third-party tests

1 participant