mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-17 02:15:31 +02:00
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:
co-authored by
Claude Fable 5
parent
bd0cdbbf19
commit
415a866a4e
@@ -88,9 +88,13 @@ describe('slug cache hygiene', () => {
|
|||||||
test('an env-less run caches under GSTACK_HOME, not $HOME', () => {
|
test('an env-less run caches under GSTACK_HOME, not $HOME', () => {
|
||||||
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'slug-home-'));
|
const home = fs.mkdtempSync(path.join(os.tmpdir(), 'slug-home-'));
|
||||||
try {
|
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], {
|
const r = spawnSync(['bash', SLUG_BIN], {
|
||||||
cwd: os.tmpdir(),
|
cwd: os.tmpdir(),
|
||||||
env: { ...process.env, GSTACK_HOME: home },
|
env: { ...ambient, GSTACK_HOME: home },
|
||||||
});
|
});
|
||||||
expect(r.exitCode).toBe(0);
|
expect(r.exitCode).toBe(0);
|
||||||
const entries = fs.readdirSync(path.join(home, 'slug-cache'));
|
const entries = fs.readdirSync(path.join(home, 'slug-cache'));
|
||||||
|
|||||||
Reference in New Issue
Block a user