test: isolate suites from the real ~/.pi and from each other

Several suites read and write ~/.pi/agent/{auth,qoder-models-cache}.json.
Vitest runs files in parallel, so one file could truncate a file another
was reading, and a run also clobbered the developer's own ~/.pi state.
Give each test file its own HOME.

Isolation exposed a latent coupling in the stream suite: with no resolved
identity on disk, streamQoder fetches /userinfo first and consumes the
single mocked Response, so the chat read failed on a locked stream. The
suite only passed because another file left credentials behind. Stub the
identity so the mock only ever serves the chat request.

Co-authored-by: Simon Shi <simonsmh@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-31 15:57:41 +00:00
co-authored by Simon Shi
parent e98526a8cd
commit 1dd1b0988b
3 changed files with 39 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
import { defineConfig } from "vitest/config";
export default defineConfig({
test: {
setupFiles: ["./src/__tests__/setup.ts"],
},
});