Creates and manages snapshot tests for UI components and data using Jest, Vitest, or pytest to detect regressions in rendered output.
How this skill is triggered — by the user, by Claude, or both
Slash command
/snapshot-test-manager:managing-snapshot-testsThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create, update, and maintain snapshot tests for UI components and data structures using Jest, Vitest, or pytest snapshot plugins. Manages serialized output snapshots (HTML, JSON, component trees) to detect unexpected changes in rendered output.
Create, update, and maintain snapshot tests for UI components and data structures using Jest, Vitest, or pytest snapshot plugins. Manages serialized output snapshots (HTML, JSON, component trees) to detect unexpected changes in rendered output.
pytest-snapshot/syrupy for Python.snap files or __snapshots__/ directory)expect(result).toMatchSnapshot() or toMatchInlineSnapshot().__snapshots__/ComponentName.test.ts.snap."renders with error state", "displays loading skeleton".jest --updateSnapshot or vitest --update after verifying changes are correct.jest --ci to detect obsolete snapshots that no longer match any test..snap files for removed components.--ci flag which treats missing snapshots as failures.toMatchObject for partial structure matching.*.test.ts or *.test.tsx) with toMatchSnapshot() assertions__snapshots__/*.snap)| Error | Cause | Solution |
|---|---|---|
| Snapshot mismatch on unrelated change | Component depends on a shared style or context provider | Isolate components with wrapper providers; mock global styles |
| Snapshot file is enormous (>1000 lines) | Entire page DOM serialized instead of target component | Narrow the snapshot scope to the specific component subtree; use container.querySelector |
| Obsolete snapshot warning | Test was renamed or deleted but .snap file remains | Run jest --updateSnapshot to remove orphaned entries; delete unused .snap files |
| Snapshot differs between local and CI | Different Node.js version or OS renders slightly different output | Pin Node.js version in CI; use toMatchInlineSnapshot for exact control |
| Non-deterministic snapshot | Component includes random keys, timestamps, or Math.random() | Mock Date.now() and Math.random(); use expect.any(String) for volatile fields |
React component snapshot test (Jest):
import { render } from '@testing-library/react';
import { Alert } from './Alert';
describe('Alert', () => {
it('renders success variant', () => {
const { container } = render(
<Alert variant="success" message="Operation completed" />
);
expect(container.firstChild).toMatchSnapshot();
});
it('renders error with inline snapshot', () => {
const { container } = render(
<Alert variant="error" message="Something failed" />
);
expect(container.firstChild).toMatchInlineSnapshot(`
<div class="alert alert-error" role="alert">
<span>Something failed</span>
</div>
`);
});
});
Custom serializer to exclude dynamic IDs:
// jest.config.ts
export default {
snapshotSerializers: ['./test/serializers/strip-ids.ts'],
};
// test/serializers/strip-ids.ts
export const serialize = (val: string) =>
val.replace(/id="[a-z0-9-]+"/g, 'id="[dynamic]"');
export const test = (val: unknown) => typeof val === 'string' && val.includes('id=');
npx claudepluginhub jeremylongshore/claude-code-plugins-plus-skills --plugin snapshot-test-managerGuides use of snapshot testing for stable outputs like serialized JSON, HTML, and error messages using toMatchSnapshot and toMatchInlineSnapshot. Covers selective invocation, updating snapshots, and when to avoid snapshots.
Detects UI visual regressions via screenshot comparisons using Playwright, Cypress, Percy. Generates diffs, handles responsive breakpoints, and integrates with CI.
Patterns for snapshot testing in .NET applications using Verify. Covers API responses, scrubbing non-deterministic values, custom converters, HTTP response testing, email templates, and CI/CD integration. Use when implementing snapshot tests for API responses, verifying UI component renders, detecting unintended changes in serialization output, or approving public API surfaces.