mcpField
F
frontend-testing

frontend-testing

github.com/aj-geddesテスト・品質373510 回インストール34 週間前に更新
リポジトリ

frontend-testing について

フロントエンド開発者向けに、ユニット、統合、エンドツーエンドのテストスイート作成を支援するスキルです。React、Vueなどのガイドを提供します。

主な機能

  1. 01ユニットテストの作成
  2. 02統合テストの作成
  3. 03エンドツーエンドテストの作成
  4. 04React、Vue、Jest、Vitest、Cypressのガイド
  5. 05テストカバレッジの設定

活用シーン

  1. 01フロントエンドコンポーネントのテスト
  2. 02コンポーネント間の統合確認
  3. 03エンドツーエンドの回帰テスト
  4. 04デプロイ前のテストカバレッジ確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill frontend-testing

インストール後、Claude Code で/frontend-testingを入力して読み込まれたか確認します。

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

references/
cypress-e2e-testing.md
jest-unit-testing-react.md
react-testing-library-integration-tests.md
test-coverage-configuration.md
vitest-for-vue-testing.md
scripts/
scaffold-tests.sh
templates/
test-template.js

詳細

フロントエンドテスト

目次

概要

適切なカバレッジとアサーションを備えた、ユニットテスト、統合テスト、エンドツーエンドテストを含む、包括的なフロントエンドアプリケーションのテストスイートを作成します。

使用する場面

  • コンポーネントのテスト
  • 統合テスト
  • エンドツーエンドテスト
  • リグレッションの防止
  • 品質保証
  • テスト駆動開発

クイックスタート

最小限の動作例:

// Button.test.tsx
import { render, screen, fireEvent } from '@testing-library/react';
import '@testing-library/jest-dom';
import { Button } from './Button';

describe('Button Component', () => {
  it('renders button with text', () => {
    render(<Button>Click me</Button>);
    expect(screen.getByRole('button')).toHaveTextContent('Click me');
  });

  it('calls onClick handler when clicked', () => {
    const handleClick = jest.fn();
    render(<Button onClick={handleClick}>Click</Button>);

    fireEvent.click(screen.getByRole('button'));
    expect(handleClick).toHaveBeenCalledTimes(1);
  });

  it('disables button when disabled prop is true', () => {
    render(<Button disabled>Click me</Button>);
    expect(screen.getByRole('button')).toBeDisabled();
  });

  it('applies variant styles correctly', () => {
// ... (see reference guides for full implementation)

リファレンスガイド

詳細な実装は references/ ディレクトリにあります:

ガイド内容
Jest Unit Testing (React)Jest Unit Testing (React)
React Testing Library Integration TestsReact Testing Library Integration Tests
Vitest for Vue TestingVitest for Vue Testing
Cypress E2E TestingCypress E2E Testing
Test Coverage ConfigurationTest Coverage Configuration

ベストプラクティス

✅ 推奨事項
  • 確立されたパターンと規約に従います
  • クリーンで保守しやすいコードを書きます
  • 適切なドキュメントを追加します
  • デプロイ前に十分にテストします
❌ 避けるべき事項
  • テストや検証を省略します
  • エラー処理を無視します
  • 設定値をハードコードします

コメント