Build: Fix tests by adding formatted diff comparison#34715
Conversation
…e changes and updating test cases to use async/await for improved readability.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughReplaced raw diff assertions in Metro config codemod tests with a new ChangesMetro Config Test — oxfmt Normalized Diffs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
Comment |
There was a problem hiding this comment.
Pull request overview
This PR stabilizes metroConfig codemod test snapshots by normalizing before/after sources with Prettier prior to generating the textual diff, avoiding failures caused purely by formatting differences.
Changes:
- Add a
getFormattedDiff()helper that formats both inputs viaprettier.format({ filepath })before callinggetDiff. - Update several inline snapshot assertions to compare formatted diffs.
- Make a few test cases
asyncand reuse a consistentfilePathvariable for formatting inference.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nline snapshots to use single quotes for consistency.
What I did
The getDiff was inconsistent due to different formatting, by adding explicit formatting, this should be solved
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Not needed
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.tsMake sure this PR contains one of the labels below:
Available labels
bug: Internal changes that fixes incorrect behavior.maintenance: User-facing maintenance tasks.dependencies: Upgrading (sometimes downgrading) dependencies.build: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup: Minor cleanup style change. Will not show up in release changelog.documentation: Documentation only changes. Will not show up in release changelog.feature request: Introducing a new feature.BREAKING CHANGE: Changes that break compatibility in some way with current major version.other: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>Summary by CodeRabbit
Tests
Refactor