vscode-test-setup
БесплатноЗапускает вложенные скриптыНе проверенThis skill provides comprehensive guidance for setting up and configuring test environments for VS Code extension projects. Use when initializing a new test…
Об этом скилле
VS Code Extension Test Environment Setup
Overview
This skill enables rapid and reliable test environment setup for VS Code extension projects. It covers test framework configuration, CI/CD integration, coverage tooling, and best practices for maintainable test infrastructure.
When to Use This Skill
- Setting up test infrastructure for new VS Code extension projects
- Migrating from one test framework to another
- Configuring CI/CD pipelines for extension testing
- Setting up code coverage tools and thresholds
- Troubleshooting test configuration issues
- Optimizing test execution performance
Quick Start Setup
Step 1: Install Dependencies
# Core testing dependencies
npm install --save-dev \
vitest \
@vscode/test-cli \
@vscode/test-electron
# Coverage is built into Vitest (uses v8 or c8 provider)
# No additional coverage packages needed
Step 2: Create Test Configuration
Run the setup script to create all necessary configuration files:
# Execute from skill directory
python scripts/setup-test-env.py --project-path /path/to/extension
Or manually create the following files:
vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['src/test/unit/**/*.test.ts'],
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
exclude: ['src/test/**', '**/*.d.ts'],
reporter: ['text', 'html', 'lcov'],
thresholds: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
testTimeout: 20000,
retry: process.env.CI ? 2 : 0
}
});
tsconfig.test.json
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "bundler",
"outDir": "./out/test",
"rootDir": "./src",
"types": ["vitest/globals", "node"]
},
"include": [
"src/test/**/*.ts"
]
}
Step 3: Configure Package.json Scripts
{
"scripts": {
"compile": "tsc -p ./",
"compile:test": "tsc -p ./tsconfig.test.json",
"watch": "tsc -watch -p ./",
"pretest": "npm run compile && npm run compile:test",
"test": "vscode-test",
"test:unit": "vitest run",
"test:integration": "vscode-test",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest --watch",
"tdd:red": "npm run test:unit -- --grep 'RED:'",
"tdd:green": "npm run test:unit",
"tdd:refactor": "npm run lint && npm run test:unit",
"tdd:quality-gate": "npm run test:coverage && npm run lint"
}
}
Step 4: Create Directory Structure
src/
├── test/
│ ├── unit/ # Pure unit tests (no VS Code API)
│ │ ├── setup.ts # Unit test setup
│ │ ├── utils.test.ts
│ │ └── models.test.ts
│ ├── integration/ # Tests requiring VS Code API
│ │ ├── setup.ts # Integration test setup
│ │ ├── extension.test.ts
│ │ └── commands.test.ts
│ ├── e2e/ # End-to-end tests
│ │ └── activation.test.ts
│ ├── fixtures/ # Test data
│ │ ├── sample-workspace/
│ │ └── test-data.json
│ └── helpers/ # Shared test utilities
│ ├── vscode-mock.ts
│ ├── async-helpers.ts
│ └── test-utils.ts
test-fixtures/ # VS Code test workspace
└── .vscode/
└── settings.json
Test Framework Configuration
Vitest Configuration
vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['src/test/unit/**/*.test.ts'],
coverage: {
provider: 'v8',
include: ['src/**/*.ts'],
exclude: ['src/test/**', '**/*.d.ts'],
reporter: ['text', 'html', 'lcov'],
thresholds: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
testTimeout: 20000,
retry: process.env.CI ? 2 : 0
}
});
Unit Test Setup (src/test/unit/setup.ts)
// Vitest provides expect, vi (mocking), and test utilities out of the box.
// No additional setup libraries (chai, sinon) are needed.
export { expect, vi, describe, it, beforeEach, afterEach } from 'vitest';
Integration Test Setup (src/test/integration/setup.ts)
Note: Integration/E2E tests that require the VS Code API still use Mocha via
@vscode/test-electron, because the VS Code test host expects a Mocha test runner. This section is intentionally kept as-is.
import * as path from 'path';
import * as Mocha from 'mocha';
import { glob } from 'glob';
export async function run(): Promise<void> {
const mocha = new Mocha({
ui: 'bdd',
color: true,
timeout: 20000,
retries: process.env.CI ? 2 : 0
});
const testsRoot = path.resolve(__dirname, '.');
const files = await gl
Установить vscode-test-setup в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл vscode-test-setup?
This skill provides comprehensive guidance for setting up and configuring test environments for VS Code extension projects. Use when initializing a new test infrastructure, configuring test runners (Vitest), setting up CI/CD test pipelines, integrating coverage tools (v8/c8), or troubleshooting test configuration issues.
Как установить скилл vscode-test-setup?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл vscode-test-setup запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic