From 35f93b3e444e63a6da3fa0cb8db275716710a539 Mon Sep 17 00:00:00 2001 From: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> Date: Tue, 1 Sep 2026 20:49:14 +0800 Subject: [PATCH] test(cli): assert structured upgrade failures Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> --- cli/test/integration/upgrade-command.test.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/cli/test/integration/upgrade-command.test.ts b/cli/test/integration/upgrade-command.test.ts index 8e514b97..005e2933 100644 --- a/cli/test/integration/upgrade-command.test.ts +++ b/cli/test/integration/upgrade-command.test.ts @@ -169,8 +169,9 @@ describe('upgrade command', () => { }) await writeFile(join(rootDir, 'late-edit', 'SKILL.md'), '# edited after planning') - await expect(executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry })) - .rejects.toThrow('local changes detected after upgrade planning') + const result = await executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry }) + expect(result.items[0]).toMatchObject({ action: 'failed' }) + expect(result.items[0]?.reason).toContain('local changes detected after upgrade planning') expect(await readFile(join(rootDir, 'late-edit', 'SKILL.md'), 'utf-8')) .toBe('# edited after planning') const inventory = JSON.parse(await readFile(join(env.home, '.skillhub', 'inventory.json'), 'utf-8')) @@ -211,8 +212,9 @@ describe('upgrade command', () => { const skillDir = join(rootDir, 'removed-late') await rm(skillDir, { recursive: true }) - await expect(executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry })) - .rejects.toThrow('installed target disappeared before upgrade commit') + const result = await executeSkillUpgradePlan(plan, { home: env.home, tokenForRegistry }) + expect(result.items[0]).toMatchObject({ action: 'failed' }) + expect(result.items[0]?.reason).toContain('installed target disappeared before upgrade commit') expect(await exists(skillDir)).toBe(false) const inventory = JSON.parse(await readFile(join(env.home, '.skillhub', 'inventory.json'), 'utf-8')) expect(inventory.items[0]).toMatchObject({ version: '1.0.0', fingerprint: 'fp-v1' })