-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add toWarnDev custom Jest matcher #3574
Conversation
Deploy preview for instantsearchjs ready! Built with commit dbb5d33 |
Would be amazing if it could be an inline snapshot. Is that possible? |
That would be a lot more difficult because inline snapshots rely on Prettier, file system and custom parsers. You can learn more in the original inline snapshots thread and in the Jest source code. I'm not aware of any helper for that. I would suggest sticking with regular expectations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good and DRYer indeed!
a61a094
to
c1ce268
Compare
c1ce268
to
dbb5d33
Compare
This adopts a similar strategy to InstantSearch (algolia/instantsearch#3260) for our bundles as well as our development warnings (algolia/instantsearch#3574).
This adopts a similar strategy to InstantSearch (algolia/instantsearch#3260) for our bundles as well as our development warnings (algolia/instantsearch#3574).
This adds a custom Jest matcher to assert that warnings are reported correctly in development mode. This matcher is called
toWarnDev
and is inspired by the one developed by the React team.It was quite cumbersome to assert that connector/widget warnings were reported and led us to sometimes skip these checks.
This PR aims at reducing this friction and providing a tool to improve DX.
Before
After
Usage
Output