问题
以下 4 个测试因依赖 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 独占工具
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
3. SessionManager adds -y when launching MCP servers through npx
- 文件:
src/tests/session.test.ts
- 原因:mock
npx 可执行文件无扩展名,Windows 上 cmd.exe 通过 PATHEXT 无法找到
4. WebSearch executes the configured script with the query as one argument
- 文件:
src/tests/web-search-handler.test.ts
- 原因:创建
#!/bin/sh 脚本文件,Windows spawn() 抛出 EFTYPE
当前状态
PR #77 中已将这 4 个测试标记为 skip: process.platform === "win32" 以恢复 Windows CI。
修复方向
- macOS 专用测试 → 维持跳过,追加平台备注
/bin/sh 回退 → 测试代码层面模拟,不实际调用 shell
- npx mock → Windows 上创建
npx.cmd 替代无扩展名文件
- WebSearch 脚本 → 改用跨平台兼容的 spawn 方式
问题
以下 4 个测试因依赖 Unix 特有的工具或执行机制,在 Windows 上无法正常运行:
1.
readClipboardImage uses osascript fallback on macOS when pngpaste is missingsrc/tests/clipboard.test.ts#!/bin/shshebang,Windows 不识别;osascript是 macOS 独占工具2.
launchNotifyScript passes DURATION and falls back to /bin/sh for non-executable scriptssrc/tests/settings-and-notify.test.ts/tmp/notify.sh和/bin/sh3.
SessionManager adds -y when launching MCP servers through npxsrc/tests/session.test.tsnpx可执行文件无扩展名,Windows 上cmd.exe通过 PATHEXT 无法找到4.
WebSearch executes the configured script with the query as one argumentsrc/tests/web-search-handler.test.ts#!/bin/sh脚本文件,Windowsspawn()抛出EFTYPE当前状态
PR #77 中已将这 4 个测试标记为
skip: process.platform === "win32"以恢复 Windows CI。修复方向
/bin/sh回退 → 测试代码层面模拟,不实际调用 shellnpx.cmd替代无扩展名文件