feat: 将 e2e-check workflow 场景转为 snapshot fixture 测试 #66
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
现有
.workflows/e2e-check.yaml定义了 45 个 CLI 场景测试,通过 workflow engine 调度 agent 在 Docker 里跑。但这些 case 全是确定性的 CLI 输入→输出,用 agent 跑太重(~4 分钟),适合转为bun test的 snapshot fixture 测试(几秒跑完,CI 自动守护)。要求
在
packages/cli-json-cas/src/新建e2e.test.ts,将以下 7 组场景转为 snapshot 测试:隔离方式
已有
cli.test.ts的runCli(args, storePath)模式:mkdtempSync建临时目录,--store指过去,完全不碰~/.uncaged/json-cas。复用此模式。测试场景(来自 e2e-check.yaml)
Phase 1: CAS Core(14 case)
Phase 2: Schema Validation(3 case)
{"name":123}→ 验证错误,exit 非零Phase 3: Variable System(11 case)
Phase 4: Template System(5 case)
Phase 5: Render(3 case)
{{ payload.name }})Phase 6: GC(3 case)
Phase 7: Edge Cases(7 case)
规范
describe块toMatchSnapshot()做输出快照(首次运行自动生成)beforeAll链式构建e2e.test.ts,和cli.test.ts同级Ref
.workflows/e2e-check.yaml— 原始场景定义packages/cli-json-cas/src/cli.test.ts— 现有测试模式参考(runClihelper)