SuperAPI AI 工具集

smoke-tests

测试与质量

查看项目

更新于 10-16 00:32

技能介绍

用途:该技能针对 VS Code 冒烟测试(位于 test/smoke/)的编写与运行,驱动完整 VS Code 实例(Electron、Web 或远程)执行端到端用户流程。

主要能力与使用方式:

  • npm run smoketest:先编译冒烟测试再运行。
  • npm run smoketest-no-compile:运行已编译的测试,CI 在显式编译步骤后使用。 两者均将 -- 后的额外参数转发给运行器 test/smoke/test/index.js。 常用选项:-g <pattern>(别名 -f)按 suite/测试标题做 mocha grep 过滤;--build <path> 针对打包构建而非源码开发构建运行;--tracing 捕获 Playwright trace 及失败截图;--web 运行浏览器冒烟测试;--headless 配合 --web 的无头模式;--remote 运行远程冒烟测试。 示例:npm run smoketest;npm run smoketest -- -g "<suite name>" --tracing;npm run smoketest-no-compile -- --tracing --build "/path/to/VSCode-darwin-arm64/Code - OSS.app"。测试失败时退出码非零。

排查 CI 偶发失败:可在临时分支上添加循环,将可疑 suite 连续运行多次(如 20 次)并在首次失败时退出,以在真实 CI 环境复现并保留 trace/截图;合并前必须移除。可加入 GitHub PR 工作流或 Azure DevOps 步骤对应的测试文件中。

日志:CI 将 .build/logs 作为产物上传。GitHub 产物名为 logs-<os>-<arch>-<suite>-<attempt>;Azure DevOps 依流水线不同为 logs-<os>-<arch>-<attempt> 或 logs-<os>-<arch>-<suite>-<attempt>。产物内 smoke-tests-<suite>/ 下有 smoke-test-runner.log、copilot-runtime-logs、扩展宿主日志和 Playwright 截图等。

限制:本技能仅覆盖冒烟测试;单元测试与集成测试分别使用 scripts/test.sh 和 scripts/test-integration.sh,不在本技能范围内。具体平台细节与完整命令请以官方资料为准。