# Snapshot Test

> Generate Jest snapshot tests for components

- Skill: `lxgicstudios/snapshot-test` (Agent Skill, multi-file: 6 files)
- Install (CLI): `npx skillmds@latest add lxgicstudios/snapshot-test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/lxgicstudios/snapshot-test/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: lxgicstudios (https://skillmd.com/u/lxgicstudios)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/lxgicstudios/snapshot-test

---


# Snapshot Test Generator

Point it at your components, get snapshot tests. Covers common states and props.

## Quick Start

```bash
npx ai-snapshot-test ./src/components/Button.tsx
```

## What It Does

- Generates Jest snapshot tests
- Covers default and edge cases
- Tests different prop combinations
- Handles async components

## Usage Examples

```bash
# Generate for a component
npx ai-snapshot-test ./src/components/Card.tsx

# Generate for directory
npx ai-snapshot-test ./src/components/

# With specific test runner
npx ai-snapshot-test ./components --runner vitest
```

## Output Example

```typescript
describe('Button', () => {
  it('renders default state', () => {
    const { container } = render(<Button>Click me</Button>);
    expect(container).toMatchSnapshot();
  });

  it('renders disabled state', () => {
    const { container } = render(<Button disabled>Click me</Button>);
    expect(container).toMatchSnapshot();
  });
});
```

## Test Cases Generated

- Default props
- Required prop variations
- Edge cases (empty, null)
- Loading/error states
- Different sizes/variants

## Requirements

Node.js 18+. OPENAI_API_KEY required.

## License

MIT. Free forever.

