diff --git a/test-setup.ts b/test-setup.ts index 1f95ab067..1cd3470f9 100644 --- a/test-setup.ts +++ b/test-setup.ts @@ -33,6 +33,11 @@ for (const name of ['GSTACK_STATE_ROOT', 'GSTACK_STATE_DIR']) { delete process.env[name]; process.stderr.write(`test-setup: stripped inherited ${name}; tests isolate state via GSTACK_HOME\n`); } +// The Capy installer's launch markers (GSTA-99, GSTA-104): a focused `bun test` +// run from a shell that sourced the launch file would hand every product child +// an unattended Capy session it never set up. The shard engine strips the same +// list for the lanes; this reaches direct runs too. +for (const name of ['GSTACK_SESSION_KIND', 'GSTACK_CAPY', 'GSTACK_EPHEMERAL', 'GSTACK_INSTALL_VERDICT']) delete process.env[name]; process.env.GSTACK_TEST_LEGACY_ROOT = path.join(os.tmpdir(), `gstack-test-legacy-root-${process.pid}-${Date.now()}-unused`); // Workflow leases (bin/gstack-lease) default to the installation's git dir; // for the dev checkout under test that is this repo's .git, and a live test diff --git a/test/shard-engine.test.ts b/test/shard-engine.test.ts index 36395f891..272d5d740 100644 --- a/test/shard-engine.test.ts +++ b/test/shard-engine.test.ts @@ -24,6 +24,7 @@ import { strictShardStatus, writeDurationSeed, zeroExecutionVerdict, + CAPY_LAUNCH_MARKERS, } from '../scripts/lib/shard-engine'; import { FREE_LANE_POLICY, exitCodeFor, runFreeShard } from '../scripts/test-free-shards'; import { @@ -252,7 +253,7 @@ describe('shard engine: capture and isolation', () => { for (const box of [a, b]) { expect(box.env.KEEP).toBe('1'); expect(box.env.GSTACK_HOME).toBeUndefined(); - for (const key of ['GSTACK_SESSION_KIND', 'GSTACK_CAPY', 'GSTACK_EPHEMERAL', 'GSTACK_INSTALL_VERDICT']) expect(box.env[key]).toBeUndefined(); + for (const key of CAPY_LAUNCH_MARKERS) expect(box.env[key]).toBeUndefined(); expect(box.env.GSTACK_STATE_ROOT).toBe('/kept-root'); for (const key of ['TMPDIR', 'TEMP', 'TMP']) expect(box.env[key]).toBe(box.tmp); expect(box.env.CHROMIUM_PROFILE).toBe(path.join(box.stateDir, 'chromium-profile'));