Skip to content

armgit / cogit

Public Imported from GitHub
0

Git for the intent behind agent-written code. Records what your coding agent decided and why, and links every commit to it.

chore: pre-run snapshot 20261027-172443

Erena4895eeb085d
diff --git a/packages/cli/test/global-setup.ts b/packages/cli/test/global-setup.ts
index 82b2fc0..f594288 100644
--- a/packages/cli/test/global-setup.ts
+++ b/packages/cli/test/global-setup.ts
@@ -1,5 +1,6 @@
import { execFileSync } from "node:child_process";
-import { existsSync } from "node:fs";
+import { existsSync, mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
@@ -10,9 +11,13 @@ const root = join(dirname(fileURLToPath(import.meta.url)), "../../..");
* tests need the template built once. It is gitignored and not guaranteed to
* exist on a fresh checkout.
*/
-export function setup(): void {
+export function setup(): () => void {
+ // Hooks leave per-session marks in the temp dir; keep tests out of the real one.
+ const tmp = mkdtempSync(join(tmpdir(), "cogit-test-"));
+ process.env.TMPDIR = tmp;
const index = join(root, "packages/template/dist/index.html");
if (!existsSync(index)) {
execFileSync("npm", ["run", "build", "-w", "template"], { cwd: root, stdio: "ignore" });
}
+ return () => rmSync(tmp, { recursive: true, force: true });
}