Skip to content

test: 为缺失的 integration-tests 增加优雅占位 runner (#34)#38

Open
appergb wants to merge 24 commits into
OrionStarAI:opensourcefrom
appergb:test/issue-34-integration-tests-placeholder
Open

test: 为缺失的 integration-tests 增加优雅占位 runner (#34)#38
appergb wants to merge 24 commits into
OrionStarAI:opensourcefrom
appergb:test/issue-34-integration-tests-placeholder

Conversation

@appergb

@appergb appergb commented May 31, 2026

Copy link
Copy Markdown

关联 issue

Closes #34

问题

package.json 中的 test:e2e / test:integration:sandbox:* 调用 integration-tests/run-tests.js,但该目录在开源时被剥离,脚本与 eslint.config.js 中针对 ./integration-tests/**/*.js 的配置块却保留了下来。结果:

  • npm run test:e2e / test:integration:* 直接以 Cannot find module .../integration-tests/run-tests.js 报错;
  • eslint integration-tests 因路径不存在报错;
  • 误导贡献者以为当前 checkout 有 E2E 覆盖。

改动(采用 issue 建议方案 3:占位脚本)

新增 integration-tests/run-tests.js

  • 打印清晰说明:E2E/集成测试套件未随开源版本提供;
  • 回显请求的 GEMINI_SANDBOX 模式,并提示单测仍可用;
  • process.exit(0) —— 作为「优雅跳过」而非硬失败(test:ci 本就不调用这些脚本);
  • 同时让 eslint integration-tests 有文件可 lint。

未补回真实用例(其内容不在开源仓库中);如后续补回完整套件,可直接替换本占位文件。

测试

  • npm run test:e2e → 退出码 0,输出清晰跳过说明(--verbose --keep-output 额外参数被安全忽略)。
  • npm run test:integration:sandbox:none → 退出码 0
  • npx eslint integration-tests → 通过(0 error)。
  • npx prettier --check integration-tests/run-tests.js → 通过。
  • 文件含仓库强制的 license 头。

jiangmuran and others added 24 commits February 11, 2026 14:28
- 新增 MermaidBlock 组件,支持流式感知的异步渲染
  - 流式阶段防抖 300ms,代码块闭合后立即渲染
  - 渲染失败时回退到上次成功的 SVG,避免图表消失
  - 通过 MutationObserver 监听 VSCode 主题切换并重新渲染
- 将 markdownComponents 重构为 MarkdownRenderer(React.memo + useMemo)
  稳定流式输出期间的组件引用,避免每次 token 更新导致
  MermaidBlock 卸载重建和 SVG 闪烁
- 修复自动滚动逻辑,通过 ResizeObserver 捕获异步内容高度变化,
  并用 scrollHeight 守卫排除内容缩小导致的误判
- webview 新增 mermaid@11.13.0 依赖
- 新增 .mermaid-block 和 .mermaid-error-badge 样式

Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
统一要求 AI 在响应中使用相对路径+行号格式引用文件
(如 src/routes/index.ts:42),便于 VSCode 等 IDE
插件场景将文件引用渲染为可点击的跳转链接。

涉及:cursor、claude-code、gemini3、vscode、default 风格

Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
工具通过提示词告知大模型 new_string 是"精确字面文本",没有特殊符号限制。

但实现使用 JS 的 String.prototype.replaceAll(string, string),
该方法会将替换字符串中的 $'、$`、$& 等特殊模式展开:
例如 $' 展开为匹配位置之后的所有内容,导致文件内容静默损坏,
工具却仍返回"Successfully modified",大模型无法感知错误。
这与给大模型的使用描述提示词不符。

将替换参数改为函数形式 replaceAll(oldString, () => newString),
函数返回值不触发任何特殊模式解析,使实现与使用描述保持一致。

Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
    根本原因:
    config.initialize() 通过 setImmediate 异步触发 discoverMcpToolsAsync(),
    工具发现完成后结果存入全局缓存 globalDiscoveredTools。但 waitForMcpDiscovery()
    仅等待发现状态变为 COMPLETED,从未将缓存中的工具同步到当前 toolRegistry
    实例,导致非交互模式下 toolRegistry.getFunctionDeclarations() 始终只返回
    内置工具,AI 无法感知和调用任何 MCP 工具。

    修复方案:
    - waitForMcpDiscovery 新增 config 参数
    - 三种状态(COMPLETED/NOT_STARTED/IN_PROGRESS)均在等待后调用
      toolRegistry.discoverMcpTools(),触发从全局缓存的同步
    - 新增 waitForMCPDiscoveryComplete 导入

Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
Signed-off-by: huangdengdui <huangdengdui@cmcm.com>
The test:e2e / test:integration:* npm scripts invoke
integration-tests/run-tests.js, but that directory was stripped during
open-sourcing while the scripts (and the eslint block targeting
integration-tests/**/*.js) were left in place. Running them failed with
a cryptic "Cannot find module" error, and contributors were misled into
thinking E2E coverage exists in this checkout.

Add a placeholder run-tests.js that prints a clear message explaining the
E2E/integration suite is not bundled with the open-source distribution
and exits 0 (a graceful skip; test:ci does not invoke these scripts).
This also gives `eslint integration-tests` a file to lint.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[测试/HIGH] integration-tests 目录缺失,test:e2e / test:integration:* 脚本失效

3 participants