component-fixtures

Creates component fixtures for screenshot testing of isolated UI components.

Updated Apr 28, 2026
Ready to run
npx skills add https://github.com/CokiStudios/cokistudios.github.io --skill component-fixtures-cokistudios
💬 Prompt for ChatGPT / Claude Chat▼
Please help me install this Agent Skill.
Skill: component-fixtures
Source: https://github.com/CokiStudios/cokistudios.github.io/tree/main/vscode-src/.github/skills/component-fixtures
Command: npx skills add https://github.com/CokiStudios/cokistudios.github.io --skill component-fixtures-cokistudios

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Visual regression testing of UI components requires rendering them in isolation, but many components depend on deep ancestor DOM structures, global services, and auto-focus behaviors that make isolated screenshot testing flaky or impossible. ## Core Features & Use Cases - Fixture Authoring Guidance: Defines the .fixture.ts file structure using defineThemedFixtureGroup, defineComponentFixture, and createEditorServices for Dark/Light themed variants. - Component Adaptation Patterns: Explains how to refactor components for fixturability, including self-contained CSS selectors, dependency injection, disabling auto-focus, and exposing domNode. - Pitfall Prevention: Covers async rendering waits, DOM reparenting flicker, service mocking with mock<T>(), and CSS scoping inside shadow DOM. - Use Case: When adding a new workbench widget, generate a fixture file that renders it in both themes, then capture screenshots via the component explorer MCP tools to verify visual output. ## Quick Start Create a component fixture for my new widget and screenshot it in dark and light themes.

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 to mock services in VS Code component fixtures?▼

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

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

Flickering usually comes from reparenting DOM nodes after async waits, which invalidates absolute positioning and triggers focus loss. Render the widget in-place with the correct DOM structure from the start instead of moving it between parents.

Does the component explorer support dark and light themes?▼

Yes, defineThemedFixtureGroup automatically creates Dark and Light variants for each fixture. Pass colorTheme: theme to createEditorServices so theme colors render correctly in both variants.

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-view will not match. Either recreate the expected ancestor DOM structure in the fixture or refactor the component CSS to use self-contained class selectors.

When should I modify the component instead of the fixture?▼

Modify the original component whenever a fixture reveals friction, such as hard-coded globals, missing domNode exposure, or auto-focus behavior. Copying and altering the component inside the fixture hides bugs and no longer tests the real lifecycle.