fix: 修复 vitest 迁移后测试失败 #65

Merged
xiaoju merged 1 commits from fix/64-test-failures into main 2026-06-03 06:16:57 +00:00
Owner

What

修复 vitest 迁移后 26 个失败测试,达到 617/617 全过。

Why

PR #63 迁移 bun:test → vitest 后,部分测试因 API 差异失败。

Changes

  • schema-validation.test.ts / liquid-render.test.ts — async 函数断言从 .toThrow() 改为 await .rejects.toThrow()(vitest 不像 bun:test 对 async 做特殊处理)
  • 所有 CLI test 文件 — 局部 runCli 函数从 execFileSync("tsx") 改为 execFileSync("node")
  • edge-cases/gc/pipe/render.test.ts — 函数签名从 rest params ...args: string[] 改为 array args: string[],修复参数被 join 成逗号分隔字符串的问题
  • 更新 snapshots

Result

36/36 files pass, 617/617 tests pass

Ref

Fixes #64

## What 修复 vitest 迁移后 26 个失败测试,达到 617/617 全过。 ## Why PR #63 迁移 bun:test → vitest 后,部分测试因 API 差异失败。 ## Changes - `schema-validation.test.ts` / `liquid-render.test.ts` — async 函数断言从 `.toThrow()` 改为 `await .rejects.toThrow()`(vitest 不像 bun:test 对 async 做特殊处理) - 所有 CLI test 文件 — 局部 `runCli` 函数从 `execFileSync("tsx")` 改为 `execFileSync("node")` - `edge-cases/gc/pipe/render.test.ts` — 函数签名从 rest params `...args: string[]` 改为 array `args: string[]`,修复参数被 join 成逗号分隔字符串的问题 - 更新 snapshots ## Result **36/36 files pass, 617/617 tests pass** ✅ ## Ref Fixes #64
xiaoju added 1 commit 2026-06-03 06:16:51 +00:00
- async 函数断言改用 await expect().rejects.toThrow()
- 所有局部 runCli 从 tsx 改为 node
- rest params (...args) 改为 array params (args)
- 更新 snapshots

36/36 files pass, 617/617 tests pass

Fixes #64
xiaoju merged commit dd75c1f39d into main 2026-06-03 06:16:57 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#65