feat(tdd-from-schema): generate response schema snapshot tests#98
Merged
PAMulligan merged 1 commit intoMay 19, 2026
Merged
Conversation
Add snapshot test patterns to the tdd-from-schema skill so generated test suites capture response body shape, headers, and error envelopes. This catches added/removed fields and renamed keys that status-code assertions miss. - Add normalizeForSnapshot / responseShape / snapshotHeaders helpers that strip UUIDs and ISO timestamps so snapshots stay stable - New Step 7 emits a *.snapshot.test.ts file per resource using toMatchInlineSnapshot for contract-critical bits (key lists, error codes, headers) and toMatchSnapshot for full normalized bodies - Document vitest -u workflow for intentional contract changes - Update Output table to list snapshot test files and __snapshots__/ Closes #47 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tdd-from-schemaskill so every generated suite captures response body keys, full normalized bodies, headers, and error envelopes — catching added/removed/renamed fields that status-code assertions miss.normalizeForSnapshot/responseShape/snapshotHeadershelpers that strip UUIDs and ISO timestamps so snapshots stay stable across runs without losing schema-drift detection.toMatchInlineSnapshot()for contract-critical bits (top-level keys, error codes, headers) so breakage shows up in the test file at code-review time, andtoMatchSnapshot()for full normalized bodies stored undertests/routes/__snapshots__/.vitest -uworkflow for intentional contract changes and updates the skill's Output table to list the new artifacts.Closes #47
Test plan
/build-from-schemaend-to-end against a sample OpenAPI spec and confirm*.snapshot.test.tsfiles are emitted per resourcepnpm vitest run -uregenerates snapshots cleanly🤖 Generated with Claude Code