Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: INSTA_FILTER, like cargo test -- filter #274

Closed
CAD97 opened this issue Aug 21, 2022 · 0 comments · Fixed by #276
Closed

Feature request: INSTA_FILTER, like cargo test -- filter #274

CAD97 opened this issue Aug 21, 2022 · 0 comments · Fixed by #276

Comments

@CAD97
Copy link
Contributor

CAD97 commented Aug 21, 2022

with similar semantics; test the filter string against the name of the snapshot, and only test it if it matches.

Minimally, this would change SnapshotAssertionContext to read INSTA_FILTER and test the name, with runtime::assert_snapshot containing an if ctx.disabled() { return } early out.

That's not super useful, though, as the only thing skipped is the snapshot comparison, and perhaps loading the old snapshot.

Where this is actually useful is with insta::glob!; if glob! can skip the execution of not-selected paths, then it's possible to test just a single execution of the glob! tests, and e.g. debug just that single snapshot test with breakpoints.

As such, it probably makes more sense to call this INSTA_GLOB_FILTER with the semantics of glob_exec building a second GlobMatcher from INSTA_GLOB_FILTER and only executing the closure if that also matches the input file.

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 a pull request may close this issue.

1 participant