component-fixtures
БесплатноБез исполняемых скриптовНе проверенUse when creating or updating component fixtures for screenshot testing or their shared infrastructure, or when designing UI components to be…
от posit-dev★ 4 361 звезда на GitHubОб этом скилле
Component Fixtures
Component fixtures render isolated UI components for visual screenshot testing via the component explorer. Fixtures live in src/vs/workbench/test/browser/componentFixtures/ and are auto-discovered by the Vite dev server using the glob src/**/*.fixture.ts.
Use tools mcp_component-exp_* to list and screenshot fixtures. If you cannot see these tools, inform the user to them on.
Running Fixtures Locally
- Start the component explorer server: run the Component Explorer Server task
- Use the
mcp_component-exp_list_fixturestool to see all available fixtures and their URLs - Use the
mcp_component-exp_screenshottool to capture screenshots programmatically
File Structure
Each fixture file exports a default defineThemedFixtureGroup(...). The file must end with .fixture.ts.
src/vs/workbench/test/browser/componentFixtures/
fixtureUtils.ts # Shared helpers (DO NOT import @vscode/component-explorer elsewhere)
myComponent.fixture.ts # Your fixture file
Basic Pattern
import { ComponentFixtureContext, createEditorServices, defineComponentFixture, defineThemedFixtureGroup } from './fixtureUtils.js';
export default defineThemedFixtureGroup({ path: 'myFeature/' }, {
Default: defineComponentFixture({ render: renderMyComponent }),
AnotherVariant: defineComponentFixture({ render: renderMyComponent }),
});
function renderMyComponent({ container, disposableStore, theme }: ComponentFixtureContext): void {
container.style.width = '400px';
const instantiationService = createEditorServices(disposableStore, {
colorTheme: theme,
additionalServices: (reg) => {
// Register additional services the component needs
reg.define(IMyService, MyServiceImpl);
reg.defineInstance(IMockService, mockInstance);
},
});
const widget = disposableStore.add(
instantiationService.createInstance(MyWidget, /* constructor args */)
);
container.appendChild(widget.domNode);
}
Key points:
defineThemedFixtureGroupautomatically creates Dark and Light variants for each fixturedefineComponentFixturewraps your render function with theme setup, async readiness, and disposable managementcreateEditorServicesprovides aTestInstantiationServicewith base editor services pre-registered- Always register created widgets with
disposableStore.add(...)to prevent leaks - Pass
colorTheme: themetocreateEditorServicesso theme colors render correctly
File icon themes
Fixtures use Seti file icons by default. Select another built-in theme, or disable file icons, on the individual fixture:
defineComponentFixture({ fileIconTheme: 'vs-minimal', render: renderMyComponent });
defineComponentFixture({ fileIconTheme: 'none', render: renderMyComponent });
When the rendered component reads IThemeService, pass the selected theme from ComponentFixtureContext to createEditorServices:
function renderMyComponent({ disposableStore, theme, fileIconTheme }: ComponentFixtureContext): void {
const instantiationService = createEditorServices(disposableStore, {
colorTheme: theme,
fileIconTheme,
});
}
Utilities from fixtureUtils.ts
| Export | Purpose |
|---|---|
defineComponentFixture |
Creates Dark/Light themed fixture variants from a render function |
defineThemedFixtureGroup |
Groups multiple themed fixtures into a named fixture group |
createEditorServices |
Creates TestInstantiationService with all base editor services |
registerWorkbenchServices |
Registers additional workbench services (context menu, label, etc.) |
createTextModel |
Creates a text model via ModelService for editor fixtures |
setupTheme |
Applies theme CSS to a container (called automatically by defineComponentFixture) |
darkTheme / lightTheme |
Pre-loaded ColorThemeData instances |
Important: Only fixtureUtils.ts may import from @vscode/component-explorer. All fixture files must go through the helpers in fixtureUtils.ts.
CSS Scoping
Fixtures share the document and workbench stylesheets (isolation: 'none'). The helpers scope theme and file-icon styles, but DOM, CSS, and process-wide registrations are not isolated automatically.
Shared theme initialization
fixtureUtilsCss.ts loads the shared workbench color and size registrations before generating and caching theme CSS, including the agent tokens in vs/workbench/common/agentsColors.ts and agentsSizes.ts. Keep required product-wide registrations in this shared bootstrap, not in individual fixtures: discovering another fixture must not change an existing fixture's typography or colors. Reuse lightweight registration modules from the owning shared layer rather than importing product entry points or higher-layer contributions.
Matching production CSS selectors
Many VS Code components have CSS rules scoped
Установить component-fixtures в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл component-fixtures?
Use when creating or updating component fixtures for screenshot testing or their shared infrastructure, or when designing UI components to be fixture-friendly. Covers fixture file structure, theming, service setup, CSS scoping, async rendering, validation, and common pitfalls.
Как установить скилл component-fixtures?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл component-fixtures запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic