fix(test): the cache-hygiene test strips ambient GSTACK_PROJECT_SLUG

Its env-less contract must be env-less: any ambient override leaking into a
shared-process shard flips the run into override mode, which correctly skips
the cache write the test asserts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-08-16 12:38:03 -07:00
co-authored by Claude Fable 5
parent bd0cdbbf19
commit 415a866a4e
+5 -1
View File
@@ -88,9 +88,13 @@ describe('slug cache hygiene', () => {
test('an env-less run caches under GSTACK_HOME, not $HOME', () => {
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'slug-home-'));
try {
// Strip any ambient override: a sibling test leaking
// GSTACK_PROJECT_SLUG in a shared-process shard would flip this run
// into override mode, which (correctly) skips the cache write.
const { GSTACK_PROJECT_SLUG: _drop, ...ambient } = process.env;
const r = spawnSync(['bash', SLUG_BIN], {
cwd: os.tmpdir(),
env: { ...process.env, GSTACK_HOME: home },
env: { ...ambient, GSTACK_HOME: home },
});
expect(r.exitCode).toBe(0);
const entries = fs.readdirSync(path.join(home, 'slug-cache'));