diff --git a/vitest.config.ts b/vitest.config.ts index c30412e..0c6032f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -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