fix: scope vitest to tests/ dir to avoid picking up stray worktree checkouts
Vitest's default glob isn't excluded for .claude/, so a sibling worktree under .claude/worktrees/ (e.g. worktree-ui-basic) got silently collected and run against this repo's current src/ via the "@" alias, doubling the test count and running a stale test file against current code under a shared identity. Found by an independent test-runner pass while verifying the Assignment transfer fix.
This commit is contained in:
@@ -9,6 +9,16 @@ export default defineConfig({
|
||||
},
|
||||
test: {
|
||||
environment: "node",
|
||||
// Scope explicitly to this repo's own tests/ dir — without this, Vitest's
|
||||
// default glob also picks up any stray sibling git worktree checked out
|
||||
// under .claude/worktrees/ (e.g. worktree-ui-basic), which isn't excluded
|
||||
// by Vitest's defaults since those only skip node_modules/.git/etc, not
|
||||
// .claude/. A stray worktree's stale test file still resolves the "@"
|
||||
// alias to *this* repo's src/ (see resolve.alias above, which is
|
||||
// __dirname-relative), so it silently runs old tests against current
|
||||
// code under a shared identity — confirmed happening in practice once a
|
||||
// second worktree existed.
|
||||
include: ["tests/**/*.test.ts"],
|
||||
setupFiles: ["./tests/setup.ts"],
|
||||
// Each test file spins up its own throwaway Postgres database by
|
||||
// mutating process.env.DATABASE_URL in tests/setup.ts's beforeAll (see
|
||||
|
||||
Reference in New Issue
Block a user