The premise
Feed the model snapshot files plus the components they cover; it groups them by signal and proposes a delete/keep/replace verdict.
What AI does well here
- Detect snapshots that mostly capture noise (dates, IDs)
- Spot duplicate snapshots across files
- Suggest behavior tests as replacements
What AI cannot do
- Know which UI states actually matter to your users
- Run the tests to confirm coverage
- Replace human design intent
End-of-lesson check
15 questions · take it digitally for instant feedback at tendril.neural-forge.io/learn/quiz/end-ai-coding-AI-snapshot-test-pruning-creators
When using an LLM to prune a snapshot test suite, what is the primary input the model needs?
- The compiled JavaScript bundle and build logs
- The entire project's node_modules directory
- The snapshot files along with the components they cover
- Only the test file names and their line counts
A snapshot test captures a timestamp that changes every time the test runs. How should this be classified?
- keep
- delete-noise
- mark-as-flaky
- replace-with-behavior-test
What is a key limitation of using AI to prune snapshot tests?
- AI cannot parse JavaScript syntax
- AI cannot identify duplicate snapshots
- AI cannot read JSON files
- AI cannot determine which UI states actually matter to users
An LLM finds two different snapshot files that contain identical UI output for the same component. What should it recommend?
- Keep both snapshots since redundancy improves coverage
- Replace both with a single behavior test
- Mark both for manual review only
- Delete one as a duplicate and keep the other
What type of test would an LLM likely suggest as a replacement for a snapshot that captures only dynamic IDs?
- An integration test
- A visual regression test
- A behavior-driven unit test
- A performance benchmark
Why is it important to avoid mixing snapshot deletions with behavior changes in a single pull request?
- Version control systems cannot handle mixed changes
- Behavior tests require different test runners
- The review becomes too complex to understand
- Mixed changes trigger too many CI pipeline failures
What information should accompany each snapshot classification verdict from an LLM?
- The test run duration in milliseconds
- The Git blame author information
- The exact file size in bytes
- A one-line reason explaining the classification
After an LLM proposes snapshot deletions, what must a human developer still do?
- Rewrite the entire test suite from scratch
- Delete the snapshot files without review
- Run the tests to confirm coverage is maintained
- Compile the TypeScript types
In the pruning workflow, what does the LLM use to group its recommendations?
- By component coverage
- By file creation date
- By Git branch name
- By test execution time
What characteristic makes a snapshot a candidate for deletion rather than replacement?
- It is located in a deeply nested directory
- It was created more than six months ago
- It uses the old Jest snapshot format
- It captures mostly noise like dates, IDs, or hashes
Which of these is explicitly listed as something AI cannot do when pruning snapshot tests?
- Parse JSON snapshot files
- Replace human design intent
- Generate new test code
- Identify syntactically invalid snapshots
What tool is specifically mentioned as an example of a snapshot testing framework?
- Jest
- Mocha
- Cypress
- Chai
When should a snapshot be classified as 'replace-with-behavior-test' rather than deleted?
- When the test has never failed
- When the snapshot file is larger than 1MB
- When the component being tested is user-facing and important
- When the snapshot was created in the current sprint
What risk exists if you rely solely on AI to determine which snapshots to keep?
- Important user-facing component snapshots might be incorrectly deleted
- The AI might use too much memory
- The test files might become encrypted
- Build times might increase
What does the 'verdict' in the LLM pruning workflow represent?
- A vote from the development team
- A security audit result
- A legal ruling about test ownership
- The final classification decision: keep, delete-noise, or replace-with-behavior-test