fix: allow inlineSnapshot calls in each with same snapshot#820
Merged
Conversation
✅ Deploy Preview for rstest-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the restriction that previously prevented using toMatchInlineSnapshot and toThrowErrorMatchingInlineSnapshot inside test.each and describe.each blocks. The change allows developers to use inline snapshots in parameterized tests when all test cases share the same expected snapshot value.
- Removed validation checks that threw errors when inline snapshots were used in
eachblocks - Updated e2e tests to verify the new behavior allows inline snapshots in
eachcontexts - Modified test fixture to demonstrate both passing and failing scenarios with inline snapshots in
eachblocks
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/runtime/api/snapshot.ts | Removed two validation blocks that prevented inline snapshots in test.each and describe.each contexts |
| e2e/snapshot/index.test.ts | Updated test expectations to verify inline snapshots work in each blocks, expecting 2 failures and 3 passes instead of 6 failures |
| e2e/snapshot/fixtures/inlineSnapshot.each.test.ts | Modified test fixture to demonstrate inline snapshot usage in both it.each and describe.each, with passing cases where values match and failing cases where they don't |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
allow inlineSnapshot calls in each with same snapshot.
Related Links
Checklist