From e0a7a6b68d8e7eb38a628e6a3e5854d582842d44 Mon Sep 17 00:00:00 2001 From: garrytan Date: Mon, 2 Nov 2026 15:33:34 +0000 Subject: [PATCH] test(loadouts): set the empty state root in beforeAll (GST-944) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> --- test/module-loadouts-install.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/module-loadouts-install.test.ts b/test/module-loadouts-install.test.ts index 6e18dd6c1..62b9095cb 100644 --- a/test/module-loadouts-install.test.ts +++ b/test/module-loadouts-install.test.ts @@ -6,7 +6,7 @@ * from the printed SKILL_ROOT; concurrent publishers of one identity agree; * the committed checkout stays byte-identical. */ -import { afterAll, describe, expect, test } from 'bun:test'; +import { afterAll, beforeAll, describe, expect, test } from 'bun:test'; import { spawnSync } from 'child_process'; import { createHash } from 'crypto'; import * as fs from 'fs'; @@ -20,7 +20,9 @@ import { LOCK_FILE } from '../scripts/modules-render'; const ROOT = path.resolve(import.meta.dir, '..'); const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'loadout-install-')); const savedState = { GSTACK_HOME: process.env.GSTACK_HOME, GSTACK_STATE_ROOT: process.env.GSTACK_STATE_ROOT }; -process.env.GSTACK_HOME = process.env.GSTACK_STATE_ROOT = path.join(tmp, 'empty-state'); +beforeAll(() => { + process.env.GSTACK_HOME = process.env.GSTACK_STATE_ROOT = path.join(tmp, 'empty-state'); +}); afterAll(() => { for (const [key, value] of Object.entries(savedState)) if (value === undefined) delete process.env[key]; else process.env[key] = value; fs.rmSync(tmp, { recursive: true, force: true });