Skip non-insta snapshot files in unreferenced detection#846
Merged
max-sixty merged 1 commit intomitsuhiko:masterfrom Dec 18, 2025
Merged
Skip non-insta snapshot files in unreferenced detection#846max-sixty merged 1 commit intomitsuhiko:masterfrom
max-sixty merged 1 commit intomitsuhiko:masterfrom
Conversation
Adds a quick check (`is_likely_insta_snapshot`) that reads only the first 16 bytes of each `.snap` file and verifies it starts with `---\nsource:` (or `---\r\nsource:` for CRLF). This distinguishes insta snapshots from other snapshot formats (vitest, jest) that may use the same `.snap` extension. Fixes mitsuhiko#845 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Collaborator
Author
|
@Turbo87 lmk any feedback, ty |
Collaborator
Author
|
great if you can install and try it out... |
|
you mean |
Collaborator
Author
|
yes! |
seems to work perfectly. thanks again! :) |
max-sixty
added a commit
that referenced
this pull request
Dec 18, 2025
## Summary - Add external diff tool support via `INSTA_DIFF_TOOL` environment variable (#844) - Add `test.disable_nextest_doctest` config option to `insta.yaml` (#842) - Skip non-insta snapshot files in unreferenced detection (#846) - Collect warnings from tests for display after run (#840) - Update TOML serialization to be up-to-date and backwards-compatible (#834) - Support `clippy::needless_raw_strings` lint (#828) ## Test plan - [x] All tests pass - [x] All lints pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <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
is_likely_insta_snapshot()function that reads only 16 bytes to check for---\nsource:prefixThis allows projects using both insta and other snapshot testing tools (like vitest or jest) to use
--unreferenced=rejectwithout false positives.Fixes #845
Test plan
test_unreferenced_ignores_non_insta_snapshots- verifies vitest/jest.snapfiles are not deleted by--unreferenced=deletetest_unreferenced_reject_ignores_non_insta_snapshots- verifies--unreferenced=rejectdoesn't fail on non-insta.snapfiles🤖 Generated with Claude Code