component-fixtures

Creates themed component fixtures for screenshot testing of VS Code UI widgets.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/jimeh/hucode --skill component-fixtures-jimeh
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: component-fixtures
Source: https://github.com/jimeh/hucode/tree/main/.github/skills/component-fixtures
Command: npx skills add https://github.com/jimeh/hucode --skill component-fixtures-jimeh

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building isolated, screenshot-testable UI components in a VS Code-based workbench requires correct service wiring, theming, CSS scoping, and shadow DOM setup, which is error-prone without guidance. ## Core Features & Use Cases - Fixture Authoring Guidance: Covers the .fixture.ts file structure, defineThemedFixtureGroup and defineComponentFixture patterns, and auto Dark/Light theme variants. - Service and Mock Setup: Explains createEditorServices, registering additional DI services, and creating mocks with the mock<T>() helper. - Component Adaptation Advice: Shows how to refactor components for fixture-friendliness, including shallow CSS selectors, dependency injection, disabling auto-focus, and exposing domNode. - Use Case: When adding a new workbench widget, use this Skill to write a fixture with multiple state variants (empty, loading, completed) and capture stable screenshots via the component explorer MCP tools. ## Quick Start Create a component fixture for my new widget with Dark and Light variants and screenshot it using the component explorer tools.

Frequently Asked Questions about component-fixtures

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

FAQPage Schema
How do I create a component fixture for screenshot testing?▼

Create a file ending in .fixture.ts under src/vs/workbench/test/browser/componentFixtures that exports a default defineThemedFixtureGroup. Each fixture uses defineComponentFixture with a render function, and the Vite dev server auto-discovers it via the src/**/*.fixture.ts glob.

How do I mock services in a VS Code component fixture?▼

Use createEditorServices with an additionalServices callback to register implementations or instances via reg.define and reg.defineInstance. For mocks, extend the mock<T>() helper from base/test/common/mock.js and override only the methods your component calls.

Why does my fixture screenshot flicker or show unstable layout?▼

Flickering usually comes from reparenting DOM nodes after the initial render, which triggers layout recalculation and focus loss. Build the correct DOM structure up front and render the widget in place instead of moving it after async waits.

Why do my component styles not apply inside a fixture?▼

Fixtures render inside shadow DOM, so CSS rules scoped to deep ancestor selectors like .workbench .sidebar .my-widget will not match. Recreate the expected ancestor classes in the fixture or refactor the component CSS to self-contained selectors.

Can I use a different file icon theme in a fixture?▼

Yes, pass fileIconTheme to defineComponentFixture, for example 'vs-minimal' or 'none' to disable icons. Fixtures use Seti file icons by default, and the selected theme should also be forwarded to createEditorServices when the component reads IThemeService.