描述
PR #77 中为了恢复 Windows CI,有 4 个测试被标记为跳过 Windows(skip: process.platform === "win32")。这些测试因依赖 Unix 特有的工具或执行机制,在 Windows 上无法正常运行。
跳过的测试
1. readClipboardImage uses osascript fallback on macOS when pngpaste is missing
- 文件:
src/tests/clipboard.test.ts
- 原因:mock 脚本含
#!/bin/sh shebang,Windows 不识别;osascript 本身是 macOS 独占工具
- 影响:剪贴板读取中
osascript 回退路径在 Windows 上无覆盖
2. launchNotifyScript passes DURATION and falls back to /bin/sh for non-executable scripts
- 文件:
src/tests/settings-and-notify.test.ts
- 原因:使用了 Unix 路径
/tmp/notify.sh 和 /bin/sh;生产代码中 /bin/sh fallback 逻辑在 Windows 上被主动跳过
- 影响:通知脚本
/bin/sh 回退路径在 Windows 上无覆盖
3. SessionManager adds -y when launching MCP servers through npx
- 文件:
src/tests/session.test.ts
- 原因:mock 的
npx 可执行文件无扩展名,Windows 上 cmd.exe 通过 PATHEXT 无法找到
- 影响:MCP server 启动时
-y 参数注入逻辑在 Windows 上无覆盖
4. WebSearch executes the configured script with the query as one argument
- 文件:
src/tests/web-search-handler.test.ts
- 原因:创建
#!/bin/sh 脚本文件,Windows spawn() 抛出 EFTYPE
- 影响:WebSearch 配置脚本执行路径在 Windows 上无覆盖
修复方向
每个测试需要不同的修复策略:
- macOS 专用测试 → 保持跳过,追加备注
/bin/sh 回退 → 测试代码层面模拟而不是实际调用 shell
- npx mock → 在 Windows 上创建
npx.cmd 替代无扩展名文件
- WebSearch 脚本 → 改用跨平台兼容的 spawn 方式测试
关联:PR #77
描述
PR #77 中为了恢复 Windows CI,有 4 个测试被标记为跳过 Windows(
skip: process.platform === "win32")。这些测试因依赖 Unix 特有的工具或执行机制,在 Windows 上无法正常运行。跳过的测试
1.
readClipboardImage uses osascript fallback on macOS when pngpaste is missingsrc/tests/clipboard.test.ts#!/bin/shshebang,Windows 不识别;osascript本身是 macOS 独占工具osascript回退路径在 Windows 上无覆盖2.
launchNotifyScript passes DURATION and falls back to /bin/sh for non-executable scriptssrc/tests/settings-and-notify.test.ts/tmp/notify.sh和/bin/sh;生产代码中/bin/shfallback 逻辑在 Windows 上被主动跳过/bin/sh回退路径在 Windows 上无覆盖3.
SessionManager adds -y when launching MCP servers through npxsrc/tests/session.test.tsnpx可执行文件无扩展名,Windows 上cmd.exe通过 PATHEXT 无法找到-y参数注入逻辑在 Windows 上无覆盖4.
WebSearch executes the configured script with the query as one argumentsrc/tests/web-search-handler.test.ts#!/bin/sh脚本文件,Windowsspawn()抛出EFTYPE修复方向
每个测试需要不同的修复策略:
/bin/sh回退 → 测试代码层面模拟而不是实际调用 shellnpx.cmd替代无扩展名文件关联:PR #77