test(FN-2122): isolate HOME for core and CLI vitest runs

- Add test setup files in core and CLI that override HOME to a per-worker temp directory
- Wire the new isolation setup into core and CLI vitest setupFiles before existing test bootstrap
- Add a core canary test to verify HOME, homedir(), and defaultGlobalDir() resolve under isolated temp paths
- Document how global HOME isolation complements per-fixture isolation in test-project utilities
This commit is contained in:
Fusion
2026-04-19 03:43:48 -07:00
committed by gsxdsm
parent 8e00867012
commit 9a532316cf
6 changed files with 67 additions and 2 deletions

View File

@@ -0,0 +1,10 @@
/**
* Global test isolation for CLI package.
* @see packages/core/src/__tests__/setup-test-isolation.ts
*/
import { mkdtempSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
const tempHome = mkdtempSync(join(tmpdir(), "fn-test-home-"));
process.env.HOME = tempHome;