Skip to content

enhance: only rerun failed snapshot test files when update snapshots#473

Merged
9aoy merged 2 commits intomainfrom
run-update-snapshot
Aug 14, 2025
Merged

enhance: only rerun failed snapshot test files when update snapshots#473
9aoy merged 2 commits intomainfrom
run-update-snapshot

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Aug 13, 2025

Summary

only rerun failed snapshot test files when update snapshots.

Related Links

Checklist

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

Copilot AI review requested due to automatic review settings August 13, 2025 12:05
@netlify
Copy link
Copy Markdown

netlify bot commented Aug 13, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit 82ad3df
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/689c7f9fd4dc1e0008bdb33d
😎 Deploy Preview https://deploy-preview-473--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 optimizes snapshot testing by only rerunning test files that have failed snapshots when updating snapshots, rather than rerunning all test files. This improves performance by reducing unnecessary test execution during snapshot updates.

  • Filter failed snapshot tests and only rerun those files during snapshot updates
  • Add snapshot files (**/*.snap) to the watch ignored patterns to prevent unnecessary rebuilds

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/core/src/core/runTests.ts Filter test results to identify files with unmatched snapshots and pass them to the run function
packages/core/src/core/plugins/entry.ts Add snapshot files to the watch ignored patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

return;
}
const failedTests = testFileResult
.filter((result) => result.snapshotResult?.unmatched)
Copy link

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

The filter condition result.snapshotResult?.unmatched may not correctly identify all failed snapshot tests. Consider checking if unmatched is greater than 0, as it likely represents a count: .filter((result) => result.snapshotResult?.unmatched > 0)

Suggested change
.filter((result) => result.snapshotResult?.unmatched)
.filter((result) => (result.snapshotResult?.unmatched ?? 0) > 0)

Copilot uses AI. Check for mistakes.
@9aoy 9aoy merged commit 64a83ae into main Aug 14, 2025
17 checks passed
@9aoy 9aoy deleted the run-update-snapshot branch August 14, 2025 03:00
@9aoy 9aoy mentioned this pull request Aug 15, 2025
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.

2 participants