MCP HubMCP Hub
返回技能列表

component-testing-patterns

spences10
更新于 Today
67 次查看
5
5
在 GitHub 上查看
测试reacttesting

关于

This Claude Skill provides component testing for Svelte 5 using Vitest browser mode and real Playwright browsers. It enables testing with semantic locators, accessibility patterns, and reactive state interactions. Use it when you need reliable browser-based component tests with auto-retrying queries and real user interactions.

技能文档

Component Testing Patterns

Quick Start

import { page } from 'vitest/browser';
import { render } from 'vitest-browser-svelte';

render(Button, { label: 'Click' });
await page.getByRole('button', { name: 'Click' }).click();
await expect.element(page.getByRole('button')).toBeInTheDocument();

Core Principles

  • Locators, never containers: page.getByRole() auto-retries
  • Semantic queries: getByRole(), getByLabelText() for accessibility
  • Await assertions: await expect.element(el).toBeInTheDocument()
  • Real browsers: Tests run in Playwright, not jsdom

Common Patterns

  • Locators: page.getByRole('button'), .first(), .nth(0), .last()
  • Interactions: await input.fill('text'), await button.click()
  • Runes: Use .test.svelte.ts files, flushSync(), untrack()
  • Files: *.svelte.test.ts (browser), *.ssr.test.ts (SSR), *.test.ts (server)

References

<!-- PROGRESSIVE DISCLOSURE GUIDELINES: - Keep this file ~50 lines total (max ~150 lines) - Use 1-2 code blocks only (recommend 1) - Keep description <200 chars for Level 1 efficiency - Move detailed docs to references/ for Level 3 loading - This is Level 2 - quick reference ONLY, not a manual -->

快速安装

/plugin add https://github.com/spences10/devhub-crm/tree/main/component-testing-patterns

在 Claude Code 中复制并粘贴此命令以安装该技能

GitHub 仓库

spences10/devhub-crm
路径: .claude/skills/component-testing-patterns

相关推荐技能

evaluating-llms-harness

测试

该Skill通过60+个学术基准测试(如MMLU、GSM8K等)评估大语言模型质量,适用于模型对比、学术研究及训练进度追踪。它支持HuggingFace、vLLM和API接口,被EleutherAI等行业领先机构广泛采用。开发者可通过简单命令行快速对模型进行多任务批量评估。

查看技能

langchain

LangChain是一个用于构建LLM应用程序的框架,支持智能体、链和RAG应用开发。它提供多模型提供商支持、500+工具集成、记忆管理和向量检索等核心功能。开发者可用它快速构建聊天机器人、问答系统和自主代理,适用于从原型验证到生产部署的全流程。

查看技能

go-test

go-test Skill为Go开发者提供全面的测试指导,涵盖单元测试、性能基准测试和集成测试的最佳实践。它能帮助您正确实现表驱动测试、子测试组织、mock接口和竞态检测,同时指导测试覆盖率分析和性能基准测试。当您编写_test.go文件、设计测试用例或优化测试策略时,这个Skill能确保您遵循Go语言的标准测试惯例。

查看技能

project-structure

这个Skill为开发者提供全面的项目目录结构设计指南和最佳实践。它涵盖了多种项目类型包括monorepo、前后端框架、库和扩展的标准组织结构。帮助团队创建可扩展、易维护的代码架构,特别适用于新项目设计、遗留项目迁移和团队规范制定。

查看技能