Skip to content

fix(web): keep vitest tsconfig discovery inside the repository - #5946

Closed
404Wolf wants to merge 1 commit into
mainfrom
cursor/vitest-tsconfig-root-07f4
Closed

404Wolf wants to merge 1 commit into
mainfrom
cursor/vitest-tsconfig-root-07f4

Conversation

@404Wolf

@404Wolf 404Wolf commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Problem

bun run test cannot start on Linux:

⎯⎯⎯⎯⎯⎯⎯ Startup Error ⎯⎯⎯⎯⎯⎯⎯⎯
AggregateError: Failed to initialize projects.
  [Error: EINVAL: invalid argument, scandir '//proc/2379/net']

Three per-area vitest configs pass tsconfigPaths({ root: '../../../' }). vite-tsconfig-paths resolves root against the working directory, not against the config file. Tests run from apps/web, so '../../../' resolves to / — the plugin then crawls the entire filesystem looking for tsconfigs. On Linux that crawl reaches /proc/<pid>/net and fails with EINVAL, taking every project that extends one of these configs down with it. On macOS there is no /proc, so the walk merely wastes time and the breakage goes unnoticed.

The intended root is apps/web (where tsconfig.json lives), which is also what the top-level apps/web/vitest.config.ts gets by passing no root at all.

Fix

Resolve that root from each config's own URL, so it no longer depends on the working directory:

root: fileURLToPath(new URL('../../../', import.meta.url)),

All three files sit three levels below apps/web, so the resolved path is unchanged in intent and now correct in fact.

Verification

Before, on Linux, the run aborts during project setup. After:

 Test Files  360 passed (360)
      Tests  3428 passed | 1 todo (3429)
   Duration  139.00s

vitest_suite_runs_after_config_fix.log

Split out of #5930, where it was needed to run the suite at all. That PR keeps only the table change.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

The three per-area vitest configs passed a relative tsconfigPaths root, which
vite-tsconfig-paths resolves against the working directory rather than the
config file. Tests run from apps/web, so '../../../' pointed above the
repository root and the plugin crawled the entire filesystem looking for
tsconfigs. On Linux that crawl reaches /proc and fails with EINVAL, so
`bun run test` could not start at all; elsewhere it just wasted the walk.

Resolve the intended apps/web root from the config file's own URL instead.

Co-authored-by: Wolf Mermelstein <wolf@404wolf.com>
@coderabbitai

coderabbitai Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 64d7093b-88ed-40f6-a314-5f3b0017ce86

📥 Commits

Reviewing files that changed from the base of the PR and between bfa2826 and acd7b7f.

📒 Files selected for processing (3)
  • apps/web/src/features/notifications/vitest.config.ts
  • apps/web/src/lib/core/vitest.config.ts
  • apps/web/src/lib/queries/vitest.config.ts

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved test environment path resolution to remain within the repository.
    • Prevented unnecessary filesystem-wide configuration scanning, improving test reliability and startup behavior.

Walkthrough

Updated three Vitest configurations to derive the tsconfigPaths root from import.meta.url. The configurations now use fileURLToPath and repository-relative URL resolution instead of the relative ../../../ path. Comments document the path-resolution behavior in the core configuration.

Merge Risk: ⚪ Minimal · up to acd7b

The change keeps Vitest TypeScript configuration discovery within the repository and the test suite passes; no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses the conventional commits format with the fix(web): prefix, clearly describes the Vitest configuration fix, and is 62 characters long.
Description check ✅ Passed The description directly explains the Linux failure, identifies the filesystem-wide tsconfig scan, describes the fix in all three Vitest configurations, and reports verification results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@404Wolf 404Wolf closed this Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants