Skip to content

fix: allow inlineSnapshot calls in each with same snapshot#820

Merged
9aoy merged 1 commit intomainfrom
inlineSnapshot-each
Dec 30, 2025
Merged

fix: allow inlineSnapshot calls in each with same snapshot#820
9aoy merged 1 commit intomainfrom
inlineSnapshot-each

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Dec 30, 2025

Summary

allow inlineSnapshot calls in each with same snapshot.

describe('test inlineSnapshot in each', () => {
  it.each([
    { a: 1, b: 2 },
    { a: 2, b: 1 },
  ])('add two numbers correctly', ({ a, b }) => {
    expect(a + b).toMatchInlineSnapshot('3');
  });
});

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 30, 2025 09:04
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 30, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 281d574
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/69539588e72270000843c43e
😎 Deploy Preview https://deploy-preview-820--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 each blocks
  • Updated e2e tests to verify the new behavior allows inline snapshots in each contexts
  • Modified test fixture to demonstrate both passing and failing scenarios with inline snapshots in each blocks

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.

@9aoy 9aoy merged commit 392be6d into main Dec 30, 2025
23 checks passed
@9aoy 9aoy deleted the inlineSnapshot-each branch December 30, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants