1
0
Files
DiAL/openspec/specs/windows-test-compat/spec.md
lanyuanxiaoyao 87d946a441 fix: 修复 Windows 平台测试兼容性问题
- 新增 tests/helpers.ts 的 rmRetry 工具函数,解决 SQLite 文件句柄未及时释放导致 afterAll 清理时 EBUSY 错误
- 修改通配符测试用例,使用 bun -e 替代 echo 命令,确保跨平台行为一致
2026-05-12 22:12:32 +08:00

26 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Capability: windows-test-compat
## Purpose
确保测试在 Windows 平台上的兼容性,包括文件句柄释放后的目录清理重试机制和跨平台命令测试约定。
## Requirements
### Requirement: 测试临时目录清理 SHALL 支持重试
使用 SQLite 数据库的测试 SHALL 在 `afterAll` 中使用带重试的目录删除机制,确保在 Windows 上文件句柄未及时释放时不会导致测试失败。
#### Scenario: Windows 上 SQLite 文件句柄延迟释放
- **WHEN** 测试在 Windows 上运行,`store.close()` 后立即尝试删除临时目录
- **THEN** 删除操作 SHALL 自动重试(最多 3 次,间隔 200ms直到成功或耗尽重试次数
### Requirement: 命令检测器测试 SHALL 使用跨平台命令
命令检测器的测试 SHALL 使用 `bun -e` 脚本替代系统 `echo` 命令,确保测试断言在所有平台上行为一致。
#### Scenario: 验证非 shell 模式下特殊字符不被展开
- **WHEN** 通过 `Bun.spawn` 执行 `bun -e "console.log('*')"` 并检查 stdout 包含 `*`
- **THEN** 测试 SHALL 在 Windows 和 Linux 上均返回 `matched: true`