-
Notifications
You must be signed in to change notification settings - Fork 7
Filter invalid matchers before extending expect #16
Conversation
Awesome stuff @IanVS ! Thanks a lot, seems reasonable to me. I don't think this can break in webpack apps but I'll test it out tomorrow! |
LGTM @IanVS! I'm just wondering about the effects of the change: Seems like the original matchers are only evaluated once they are accessed via their getters: And the I guess that just means a very slight performance impact, which I'm fine with |
Generally good change, but I'd rather keep the original getter behavior. So instead of spreading |
Unfortunately that's not possible, which is why I had to spread into a new object. Trying to delete the
|
Also note, I'm hoping this change is only temporary until testing-library/jest-dom#438 can be released, which will avoid this problem by using real esm instead of this unfortunate bundler behavior. |
I added a reminder in the code to undo that once the other PR is done. Thank you so much @IanVS for pushing Vite forward and sticking with us to make this first class support! |
🚀 PR was released in |
Change Type
Closes #15
This fixes @storybook/jest for vite projects, by removing the
__esmodule
anddefault
properties (and anything else that isn't a valid matcher type, or at least that's undefined or boolean) before extending expect.I've tested this in my own vite project by copying the build file into my node_modules, and it worked as expected. It would be good to double-check in a webpack project as well, though.
This should only be needed until/unless testing-library/jest-dom#438 is released and can be used.
Indicate the type of change your pull request is:
maintenance
documentation
patch
minor
major
📦 Published PR as canary version:
0.0.10--canary.16.6472401.0
✨ Test out this PR locally via: