Skip to content

chore(test): move vitest cache to node_modules/.cache#1274

Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/vitest-cache-to-node-modules
Apr 24, 2026
Merged

chore(test): move vitest cache to node_modules/.cache#1274
John-David Dalton (jdalton) merged 1 commit intomainfrom
chore/vitest-cache-to-node-modules

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 24, 2026

Summary

  • Vitest's cacheDir moves from <repo>/.cache/vitest to <repo>/node_modules/.cache/vitest in the shared vitest base config. The isolated config extends from it, so it picks up the change automatically.
  • pnpm install already wipes node_modules/ (and its .cache/ subdir), so this buys us free cache invalidation on every install — no dedicated clean step needed.
  • Matches the pattern just applied in ../socket-packageurl-js, ../socket-sdk-js (Cleanup debugFn messages #616), and ../meander.
  • Drops **/.cache/ from .gitignore since nothing writes to a top-level .cache/ anymore.

Test plan

  • CI runs pnpm lint + pnpm test + pnpm run build.
  • Local pnpm install / pnpm test — not run here; the worktree I authored this from had a pre-existing packages/package-builder/build/… workspace-link issue that blocked install. The pre-commit hook's docstring expressly allows --no-verify for local bypass while the pre-push hook continues to enforce security checks, so the commit was made with --no-verify knowing CI will fully verify. Nothing in the diff would be affected by the skipped local check (it's a 2-line config change + gitignore cleanup).

Note

Low Risk
Low risk: only changes test runner cache location and a gitignore pattern, with no runtime or production code impact.

Overview
Vitest now writes its cache to node_modules/.cache/vitest (instead of a top-level .cache/vitest), relying on pnpm install to naturally invalidate caches by wiping node_modules/.

.gitignore is tightened by removing the broad **/.cache/ ignore since the repo no longer uses a top-level .cache/ directory for Vitest.

Reviewed by Cursor Bugbot for commit 021b8ac. Configure here.

`pnpm install` already clears `node_modules/` (and its `.cache/`
subdir) automatically, so pinning vitest's cacheDir there gives
us free cache invalidation on every install without needing a
dedicated clean step. Matches the pattern applied in
../socket-packageurl-js, ../socket-sdk-js, and ../meander.

Applied to the shared vitest base config (the isolated config
extends from it, so it picks up the change automatically).

Dropped `**/.cache/` from .gitignore — nothing writes to a
top-level `.cache/` anymore; remaining cache consumers all land
under node_modules.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 021b8ac. Configure here.

Comment thread .gitignore
@jdalton John-David Dalton (jdalton) merged commit 5c6b1b3 into main Apr 24, 2026
6 checks passed
@jdalton John-David Dalton (jdalton) deleted the chore/vitest-cache-to-node-modules branch April 24, 2026 22:18
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.

2 participants