vscode-extension-testing

Guide unit and integration testing of VS Code extensions with Sinon and the VS Code Test Harness.

Updated Jan 25, 2026
One-click install
npx skills add https://github.com/mikejhill/vscode-editor-switcher --skill vscode-extension-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vscode-extension-testing
Source: https://github.com/mikejhill/vscode-editor-switcher/tree/main/.github/skills/vscode-extension-testing
Command: npx skills add https://github.com/mikejhill/vscode-editor-switcher --skill vscode-extension-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides a comprehensive guide to writing effective unit and integration tests for VS Code extensions, ensuring reliable and accurate behavior.

Core Features & Use Cases

  • Unit Testing: Learn to mock VS Code APIs using Sinon for isolated testing of your extension's logic.
  • Integration Testing: Understand how to use the VS Code Test Harness to validate end-to-end extension behavior with real APIs.
  • Assertion Best Practices: Master writing specific, meaningful assertions with clear messages to improve test diagnostics.
  • Use Case: When developing a new VS Code extension feature, use this Skill to structure your tests, mock dependencies correctly, and ensure your commands function as expected in a real VS Code environment.

Quick Start

Use the vscode-extension-testing skill to learn how to mock VS Code APIs for unit tests.

Frequently Asked Questions about vscode-extension-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I mock VS Code APIs for unit testing an extension?

Mock VS Code APIs for unit testing by utilizing Sinon to stub extension dependencies. This isolates your extension's logic, ensuring tests validate specific behaviors without triggering real editor side effects.

What is the VS Code Test Harness used for in integration tests?

The VS Code Test Harness is used to validate end-to-end extension behavior with real APIs. It executes your commands within an actual VS Code environment to ensure accurate functionality.

How do I avoid writing no-op tests for VS Code extensions?

Avoid writing no-op tests by implementing assertion best practices with specific, meaningful checks and clear messages. Ensure your tests validate actual command behavior rather than just executing functions without expectations.

When should I use unit tests versus integration tests for a VS Code extension?

Use unit tests with Sinon mocking to isolate and verify internal extension logic, and use integration tests with the VS Code Test Harness to validate end-to-end command behavior with real APIs.

Why do my VS Code extension tests fail to catch command execution errors?

Tests often fail to catch errors due to redundant testing or non-specific assertions. Write specific, meaningful assertions with clear messages to properly diagnose command execution failures in the VS Code environment.