一键导入
run-smoke-tests
Run smoke tests to verify extension functionality in a real VS Code environment. Use this when checking if basic features work after changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run smoke tests to verify extension functionality in a real VS Code environment. Use this when checking if basic features work after changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | run-smoke-tests |
| description | Run smoke tests to verify extension functionality in a real VS Code environment. Use this when checking if basic features work after changes. |
Run smoke tests to verify the extension loads and basic functionality works in a real VS Code environment.
| Action | Command |
|---|---|
| Run all smoke tests | npm run compile && npm run compile-tests && npm run smoke-test |
| Run specific test | npm run smoke-test -- --grep "Extension activates" |
| Debug in VS Code | Debug panel → "Smoke Tests" → F5 |
Unlike unit tests (which mock VS Code), smoke tests run inside a real VS Code instance:
npm run smoke-test uses @vscode/test-cli.vscode-test/)This is why smoke tests are slower (~10-60s) but catch real integration issues.
npm run compile && npm run compile-tests && npm run smoke-test
Pass: 4 passing (2s) → Extension works, proceed.
Fail: See error message and check Debugging section.
To run a specific test instead of the whole suite:
# By test name (grep pattern)
npm run smoke-test -- --grep "Extension activates"
# Or temporarily add .only in code:
test.only('Extension activates without errors', ...)
| Error | Cause | Fix |
|---|---|---|
Extension not installed | Build failed or ID mismatch | Run npm run compile, check extension ID |
Extension did not become active | Error in activate() | Debug with F5, check Debug Console |
Command not registered | Missing from package.json | Add to contributes.commands |
Timeout exceeded | Slow startup or infinite loop | Increase timeout or check for blocking code |
For detailed debugging, use VS Code: Debug panel → "Smoke Tests" → F5
Create a new file in src/test/smoke/ with the naming convention *.smoke.test.ts:
import * as assert from 'assert';
import * as vscode from 'vscode';
import { waitForCondition } from '../testUtils';
import { ENVS_EXTENSION_ID } from '../constants';
suite('Smoke: [Feature Name]', function () {
this.timeout(60_000);
test('[Test description]', async function () {
// Arrange
const extension = vscode.extensions.getExtension(ENVS_EXTENSION_ID);
assert.ok(extension, 'Extension not found');
// Ensure extension is active
if (!extension.isActive) {
await extension.activate();
}
// Act
const result = await someOperation();
// Assert
assert.strictEqual(result, expected, 'Description of what went wrong');
});
});
Key patterns:
waitForCondition() instead of sleep() for async assertionsthis.timeout(60_000))| File | Purpose |
|---|---|
src/test/smoke/activation.smoke.test.ts | Extension activation tests |
src/test/smoke/index.ts | Test runner entry point |
src/test/testUtils.ts | Utilities (waitForCondition, etc.) |
npm run compile (webpack) before tests run. The test runner uses dist/extension.js which is only created by webpack, not by npm run compile-tests (tsc)npm run compile before tests.vscode-test/)Critical patterns for cross-platform path handling in this VS Code extension. Windows vs POSIX path bugs are the #1 source of issues. Use this skill when reviewing or writing path-related code.
Generate a codebase health snapshot for technical debt tracking and planning. Analyzes git history, code complexity, debt markers, and dependencies to identify hotspots and refactoring priorities.
Environment manager-specific discovery patterns and known issues. Use when working on or reviewing environment discovery code for conda, poetry, pipenv, pyenv, or venv.
Run the mandatory pre-commit checks before committing code. Includes lint, type checking, and unit tests. MUST be run before every commit.
VS Code settings precedence rules and common pitfalls. Essential for any code that reads or writes settings. Covers getConfiguration scope, inspect() vs get(), and multi-workspace handling.
Debug a failing test using an iterative logging approach, then clean up and document the learning.