SuperAPI AI 工具集

integration-tests

测试与质量

查看项目

更新于 10-16 03:44

技能介绍

用途:在 VS Code 仓库中运行集成测试。集成测试分两类:src/ 下以 .integrationTest.ts 结尾的 Node.js 集成测试(在 Electron 中通过 Mocha 运行);extensions/ 下内置于扩展中的扩展宿主测试(API、Git、TypeScript 等),会以 --extensionDevelopmentPath 启动完整 VS Code 实例。

用法:macOS/Linux 运行 ./scripts/test-integration.sh [options];Windows 运行 .\scripts\test-integration.bat [options]。无过滤时依次运行全部 Node.js 集成测试与全部扩展宿主测试;仅用 --run 或 --runGlob(不带 --suite)时只跑 Node.js 集成测试;仅用 --grep 时两类测试全跑并转发该模式;用 --suite 时只跑匹配的扩展宿主套件,跳过 Node.js 集成测试,可再配合 --grep 过滤套件内用例。

主要选项:--run <file> 运行指定文件(如 ./scripts/test-integration.sh --run src/vs/workbench/services/search/test/browser/search.integrationTest.ts);--runGlob <pattern>(别名 --glob、--runGrep)按编译后 .js 路径匹配,仅用于 Node.js 集成测试;--grep <pattern>(别名 -g、-f)按用例标题过滤;--suite <pattern> 运行指定扩展宿主套件,支持逗号分隔与 shell glob(仅 macOS/Linux),可用套件名包括 api-folder、api-workspace、colorize、terminal-suggest、typescript、markdown、emmet、git、git-base、ipynb、notebook-renderers、configuration-editing、github-authentication、css、html;--help/-h 显示帮助。其余选项(如 --timeout、--coverage、--reporter)转发给 scripts/test.sh,使用 --suite 时不转发给扩展宿主套件。

限制:测试针对编译后的 JavaScript 运行,需先完成编译或保持 VS Code - Build watch 任务运行。集成测试与单元测试(.test.ts)需区分:单元测试用 scripts/test.sh,集成测试用 scripts/test-integration.sh,不可混用。