mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-05 16:34:00 +01:00
test(capy-install): a setup failure after a passing install removes the earlier launch file
Fifth review cycle: setup_failed's cleanup had no assertion. The setup failure test now installs once (launch file present), commits a new HEAD so setup runs again, fails that setup, and asserts the launch file is gone and the verdict says ok:false before the next run sets up again and ends ok. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
9c8f7cf03a
commit
870c6268c1
1 file changed
+11
-2
@@ -382,13 +382,22 @@ describe('gstack-capy-install: launch PATH, Bun reuse, CI pins, setup skip, verd
|
||||
expect(f.calls().filter(l => l.startsWith('setup '))).toHaveLength(8);
|
||||
});
|
||||
|
||||
test('a setup that fails once leaves the trailer fail and records nothing; the next run sets up again and ends ok', () => {
|
||||
test('a setup that fails once leaves the trailer fail, records ok:false and removes the earlier launch file; the next run sets up again and ends ok', () => {
|
||||
const f = fixture();
|
||||
const first = run(f);
|
||||
expect(first.status, first.stdout + first.stderr).toBe(0);
|
||||
const launchFile = first.stdout.match(/^GSTACK_LAUNCH_FILE: (.+)$/m)?.[1] ?? '';
|
||||
expect(fs.existsSync(launchFile)).toBe(true);
|
||||
sh('git -c user.email=t@t -c user.name=t commit -q --allow-empty -m next', f.root);
|
||||
const failed = run(f, [], { STUB_SETUP_EXIT: '1' });
|
||||
expect(failed.status).toBe(1);
|
||||
expect(lastLine(failed.stdout)).toMatch(/^gstack: fail setup/);
|
||||
expect(failed.stdout).not.toMatch(/^GSTACK_LAUNCH_FILE:/m);
|
||||
expect(fs.existsSync(launchFile)).toBe(false);
|
||||
expect(JSON.parse(fs.readFileSync(launchFile.replace(/\.env$/, '.json'), 'utf8'))).toMatchObject({ ok: false });
|
||||
expect(run(f).status).toBe(0);
|
||||
expect(f.calls().filter(l => l.startsWith('setup '))).toHaveLength(3);
|
||||
expect(fs.existsSync(launchFile)).toBe(true);
|
||||
expect(f.calls().filter(l => l.startsWith('setup '))).toHaveLength(5);
|
||||
});
|
||||
|
||||
test.skipIf(process.platform !== 'linux')('PATH Bun 1.4.3 and a CI pin of 1.4.2: the pinned verified Bun is installed alongside and launched with its PATH', () => {
|
||||
|
||||
Reference in new issue
Block a user