Skip to content

Windows: 4 tests skipped due to cross-platform incompatibility #79

@Lellansin

Description

@Lellansin

描述

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 上无覆盖

修复方向

每个测试需要不同的修复策略:

  1. macOS 专用测试 → 保持跳过,追加备注
  2. /bin/sh 回退 → 测试代码层面模拟而不是实际调用 shell
  3. npx mock → 在 Windows 上创建 npx.cmd 替代无扩展名文件
  4. WebSearch 脚本 → 改用跨平台兼容的 spawn 方式测试

关联:PR #77

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions