인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
개발 및 엔지니어링 · SKILL.md

snapshot-writer

snapshot-writer

Generate Jest snapshot tests for React components. Use when you need snapshot coverage for your UI components.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: snapshot-writer description: Generate Jest snapshot tests for React components. Use when you need snapshot coverage for your UI components.

Snapshot Test Writer

Snapshot tests are the fastest way to catch unintended UI changes. But writing them for every component gets tedious fast. This tool reads your React components and generates snapshot tests automatically. It figures out the props, renders the component, and creates the snapshot assertions.

One command. Zero config. Just works.

Quick Start

npx ai-snapshot-test src/components/

What It Does

  • Reads React components and generates Jest snapshot test files
  • Automatically detects props and creates test cases with different prop combinations
  • Handles components with context providers and wrapper dependencies
  • Generates both default state and edge case snapshots
  • Outputs .test.tsx files ready to run with Jest

Usage Examples

# Generate snapshot tests for all components
npx ai-snapshot-test src/components/

# Target a specific component
npx ai-snapshot-test src/components/Button.tsx

# Scan all TSX files in a directory
npx ai-snapshot-test "src/**/*.tsx"

Best Practices

  • Generate snapshots early in development - Easier to maintain when you start small
  • Update snapshots intentionally - When a snapshot fails, check if the change was intended before updating
  • Don't snapshot everything - Focus on components with stable output. Highly dynamic components make bad snapshot candidates.
  • Keep snapshot files in version control - They're your visual contract

When to Use This

  • You're building a component library and need regression protection
  • A redesign changed a bunch of components and you need to update test coverage
  • You want to catch accidental rendering changes during refactors
  • Your team requires snapshot tests but nobody wants to write them

Part of the LXGIC Dev Toolkit

This is one of 110+ free developer tools built by LXGIC Studios. No paywalls, no sign-ups, no API keys on free tiers. Just tools that work.

Find more:

Requirements

No install needed. Just run with npx. Node.js 18+ recommended.

npx ai-snapshot-test --help

How It Works

The tool parses your React component files to extract the component signature, props interface, and any dependencies. It then generates test files that import the component, render it with various prop combinations, and create toMatchSnapshot assertions. The output is compatible with Jest's snapshot testing.

License

MIT. Free forever. Use it however you want.

저장한 Skills