Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@max-sixty
Copy link
Collaborator

When using INSTA_GLOB_FILTER, the common prefix used for snapshot naming should be derived from all files matching the original glob pattern, not just the filtered subset. This ensures that snapshot names retain their original file suffixes (e.g., @file.txt.snap) even when only a single file is matched by the filter.

Adds a test case to verify this behavior.

Co-authored-by: Claude [email protected]

When using `INSTA_GLOB_FILTER`, the common prefix used for snapshot naming should be derived from all files matching the original glob pattern, not just the filtered subset. This ensures that snapshot names retain their original file suffixes (e.g., `@file.txt.snap`) even when only a single file is matched by the filter.

Adds a test case to verify this behavior.

Co-authored-by: Claude <[email protected]>
@max-sixty max-sixty changed the title Fix: Preserve snapshot names with INSTA_GLOB_FILTER Preserve snapshot names with INSTA_GLOB_FILTER Jul 6, 2025
@max-sixty max-sixty merged commit 7793782 into mitsuhiko:master Jul 6, 2025
15 checks passed
max-sixty added a commit that referenced this pull request Sep 4, 2025
## Summary
- Updates CHANGELOG.md to move all unreleased changes into the 1.43.2
section
- Prepares for tagging version 1.43.2

## Changes included in 1.43.2
- Fix panics when `cargo metadata` fails to execute or parse (#798)
- Fix clippy `uninlined_format_args` lint warnings (#801)  
- Changed diff line numbers to 1-based indexing (#799)
- Preserve snapshot names with `INSTA_GLOB_FILTER` (#786)
- (Plus other changes already listed in the 1.43.2 section)

## Test plan
- [x] CHANGELOG.md updated with all recent changes
- [ ] Ready to tag as 1.43.2 after merge

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <[email protected]>
kkysen added a commit to immunant/c2rust that referenced this pull request Sep 25, 2025
…ER` so that the snapshot file is correctly resolved (#1377)

`INSTA_GLOB_FILTER` conveniently lets you run things like
`INSTA_GLOB_FILTER=*/macros.c cargo test -p c2rust-transpile` to only
test `macros.c`. However, previously, limiting the filter to a single
snapshot messed up how the snapshot file path was calculated, resulting
in a different snapshot (mitsuhiko/insta#785).
Now this is fixed by mitsuhiko/insta#786, so
this just updates to the latest `insta` version, which includes this
fix.
@max-sixty max-sixty deleted the glob-filter-2 branch December 29, 2025 03:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant