帮助开发者在 VS Code 仓库中运行、筛选并调试单元测试。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "unit-tests" 技能: 1. 下载 https://raw.githubusercontent.com/microsoft/vscode/main/.github/skills/unit-tests/SKILL.md 2. 保存为 ~/.claude/skills/unit-tests/SKILL.md 3. 装好后重载技能,告诉我可以用了
请告诉我在 VS Code 仓库里如何运行指定的单元测试文件,并给出 macOS/Linux 与 Windows 的命令示例。
返回适用平台的测试命令,并说明如何指定目标测试文件。
我只想运行名称包含 editor tabs 的单元测试,请给我可用的过滤参数和示例命令。
返回按测试名称筛选的参数用法,并附上可直接执行的示例命令。
请说明如何在 VS Code 仓库中以调试模式运行单元测试,包括常用脚本、参数以及排查失败测试的建议。
给出调试测试的运行方式、相关参数说明,以及定位失败原因的实用建议。
runTests toolIf the runTests tool is available, prefer it over running shell commands. It provides structured output with detailed pass/fail information and supports filtering by file and test name.
files parameter.testNames parameter to filter which tests run.mode="coverage" to collect coverage.Example (conceptual): run tests in src/vs/editor/test/common/model.test.ts with test name filter "should split lines".
When the runTests tool is not available (e.g. in CLI environments), use the platform-appropriate script from the repo root:
./scripts/test.sh [options].\scripts\test.bat [options]These scripts download Electron if needed and launch the Mocha test runner.
Pass source file paths directly as positional arguments. The test runner automatically treats bare .ts/.js positional arguments as --run values.
./scripts/test.sh src/vs/editor/test/common/model.test.ts
.\scripts\test.bat src\vs\editor\test\common\model.test.ts
Multiple files:
./scripts/test.sh src/vs/editor/test/common/model.test.ts src/vs/editor/test/common/range.test.ts
--run <file> - Run tests from a specific file (explicit form)Accepts a source file path (starting with src/). The runner strips the src/ prefix and the .ts/.js extension automatically to resolve the compiled module.
./scripts/test.sh --run src/vs/editor/test/common/model.test.ts
Multiple files can be specified by repeating --run:
./scripts/test.sh --run src/vs/editor/test/common/model.test.ts --run src/vs/editor/test/common/range.test.ts
--grep <pattern> (aliases: -g, -f) - Filter tests by nameRuns only tests whose full title matches the pattern (passed to Mocha's --grep).
./scripts/test.sh --grep "should split lines"
Combine with --run to filter tests within a specific file:
./scripts/test.sh --run src/vs/editor/test/common/model.test.ts --grep "should split lines"
--runGlob <pattern> (aliases: --glob, --runGrep) - Run tests matching a globRuns all test files matching a glob pattern against the compiled output directory. Useful for running all tests under a feature area.
./scripts/test.sh --runGlob "**/editor/test/**/*.test.js"
Note: the glob runs against compiled .js files in the output directory, not source .ts files.
--coverage - Generate a coverage report./scripts/test.sh --run src/vs/editor/test/common/model.test.ts --coverage
--timeout <ms> - Set test timeoutOverride the default Mocha timeout for long-running tests.
./scripts/test.sh --run src/vs/editor/test/common/model.test.ts --timeout 10000
Integration tests (files ending in .integrationTest.ts or located in extensions/) are not run by scripts/test.sh. Use scripts/test-integration.sh (or scripts/test-integration.bat) instead. See the integration-tests skill for details.
Tests run against compiled JavaScript output. Ensure the VS Code - Build watch task is running or that compilation has completed before running tests. Test failures caused by stale output are a common pitfall.
帮助开发者验证 Azure DevOps 流水线改动,快速排查构建与 YAML 配置问题。
自动驱动 VS Code 性能与内存排查,生成可复现分析结果与对比证据。