feat(FN-2606): merge fusion/fn-2606 (auto-resolved)

- fix(FN-2606): complete Step 4 — clean up mkdtemp test directories
- test(FN-2606): complete Step 3 — add isolation guard coverage
- feat(FN-2606): complete Step 2 — add engine/dashboard HOME test isolation setup
This commit is contained in:
Fusion
2026-04-26 13:00:56 -07:00
committed by gsxdsm
parent 545c8a69f4
commit 429b9671b2
11 changed files with 149 additions and 27 deletions

View File

@@ -1,5 +1,7 @@
import { describe, expect, it } from "vitest";
import { homedir, tmpdir } from "node:os";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const TEMP_HOME_PREFIX = "fn-test-home-";
@@ -26,4 +28,20 @@ describe("test isolation setup", () => {
expect(dir).toContain(tmpdir());
expect(dir).toMatch(/fn-test-home-.*[\\/]\.fusion$/);
});
it("GlobalSettingsStore() without explicit dir throws under VITEST guard", async () => {
const { GlobalSettingsStore } = await import("../global-settings.js");
expect(() => new GlobalSettingsStore()).toThrow(
"resolveGlobalDir() called without explicit dir during test execution. Pass a temp directory to avoid writing to real ~/.fusion/",
);
});
it("cwd is not inside the repository .fusion directory", () => {
const thisFile = fileURLToPath(import.meta.url);
const repoRoot = resolve(dirname(thisFile), "../../../../");
const repoFusionDir = join(repoRoot, ".fusion");
expect(process.cwd().startsWith(repoFusionDir)).toBe(false);
});
});