Component tester

From motormetrics/motormetrics · View interactive version

Component tester is an AI agent skill from the GitHub repository motormetrics/motormetrics. Run Vitest tests for a specific component with coverage. Use when making changes to React components to ensure tests pass and coverage is maintained.

How to use this skill

Skill file

Component Tester Skill

This Skill automatically runs Vitest tests when React components are modified to ensure code quality and test coverage.

When to Activate

Actions Performed

  1. Identify Component: Determine which component was created or modified
  2. Run Tests: Execute pnpm test -- <component-path> without watch mode
  3. Check Coverage: Verify test coverage meets project thresholds
  4. Report Results: Provide clear feedback on:

Example Usage

// User modifies: src/app/blog/_components/progress-bar.tsx
// Skill automatically runs:
// pnpm test -- src/app/blog/_components/progress-bar

// Output:
// ✓ should render progress bar with correct width
// ✓ should update progress on scroll
// ✓ should hide when not scrolled
// Coverage: 95% statements, 90% branches, 100% functions, 95% lines

Tools Used

Test Naming Convention

All tests should follow the "should" convention:

Coverage Thresholds

Flag components with coverage below:

Related Files

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.