From 1aefb067733e980af39676a1ebe26fd84a45b6a5 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 19 Oct 2026 19:15:07 +0000 Subject: [PATCH] test(cso): set GSTACK_HOME in beforeAll, not at module scope Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/cso-ordinary-repos.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/cso-ordinary-repos.test.ts b/test/cso-ordinary-repos.test.ts index f8dea3a2b..2153f854c 100644 --- a/test/cso-ordinary-repos.test.ts +++ b/test/cso-ordinary-repos.test.ts @@ -21,8 +21,11 @@ const OLD_CANARY = ['ghp_', 'zyxwvutsrqponmlkjihgfedcba0987654321'].join(''); const MARKER = '[gstack-cso history truncated:'; const roots: string[] = []; const originalHome = process.env.GSTACK_HOME; -const state = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'cso-ordinary-state-'))); -process.env.GSTACK_HOME = state; +let state = ''; +beforeAll(() => { + state = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'cso-ordinary-state-'))); + process.env.GSTACK_HOME = state; +}); afterEach(() => { for (const root of roots.splice(0)) fs.rmSync(root, { recursive: true, force: true }); });