Fix Blocks Jest private API singleton resolution#65341
Conversation
Testing GuidelinesHi @Konamiman @Aljullu @ObliviousHarmony , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR adds ChangesWordPress Patterns Test Infrastructure Integration
🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code. |
|
Size Change: -3.39 kB (-0.06%) Total Size: 5.67 MB
|
…to fix/blocks-jest-patterns-singleton
|
Actionable comments posted: 0 |
Aljullu
left a comment
There was a problem hiding this comment.
Code changes make sense. Tests are also green, so LGTM.
Submission Review Guidelines:
Changes proposed in this Pull Request:
While working on #65308, I noticed a couple of places where the Blocks unit test setup could be made more reliable.
The current approach relies on importing from an internal dependency path. If that file is moved or removed upstream, unit tests can fail unexpectedly, as happened in #65308.
unlockimportInstead of importing
unlockfrom an internal package path, this PR defines a small test utility that opts into the private API explicitly and exports theunlockfunction from there.@wordpress/patternsmockThe test setup previously mocked
@wordpress/patternsbecause it was not installed as a direct dependency. This PR adds the package properly, so the mock is no longer needed.How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Testing that has already taken place:
Milestone
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment
Improve block library unit test env.