Skip to content

Commit c03dfa9

Browse files
committed
chore(test): move vitest cache to node_modules/.cache
`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 (#616), ../socket-cli (#1274), and ../meander. Applied to both the main and isolated vitest configs. Dropped `**/.cache/` from .gitignore — nothing writes to a top-level `.cache/` anymore; the only cache consumers are now rooted under node_modules.
1 parent ee14dd4 commit c03dfa9

3 files changed

Lines changed: 2 additions & 3 deletions

File tree

.config/vitest.config.isolated.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const projectRoot = path.resolve(__dirname, '..')
1414
const toGlobPath = (pathLike: string): string => pathLike.replaceAll('\\', '/')
1515

1616
const vitestConfigIsolated = defineConfig({
17-
cacheDir: path.resolve(projectRoot, '.cache/vitest-isolated'),
17+
cacheDir: path.resolve(projectRoot, 'node_modules/.cache/vitest-isolated'),
1818
resolve: {
1919
preserveSymlinks: false,
2020
extensions: ['.mts', '.ts', '.mjs', '.js', '.json'],

.config/vitest.config.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const rootPkgJson = JSON.parse(
1919
const toGlobPath = (pathLike: string): string => pathLike.replaceAll('\\', '/')
2020

2121
const vitestConfig = defineConfig({
22-
cacheDir: path.resolve(projectRoot, '.cache/vitest'),
22+
cacheDir: path.resolve(projectRoot, 'node_modules/.cache/vitest'),
2323
resolve: {
2424
// Use 'source' export condition so @socketsecurity/lib/* imports resolve
2525
// to src/*.ts instead of dist/*.js. This enables proper v8 coverage

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ yarn.lock
2727
# ============================================================================
2828
# Build outputs and artifacts
2929
# ============================================================================
30-
**/.cache/
3130
.type-coverage/
3231
coverage/
3332
dist/

0 commit comments

Comments
 (0)