-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Interactions-addon relies on polyfilled global
(via jest-mock)
#17516
Comments
Hi, we have a report of this in the storybook-builder as well (storybookjs/builder-vite#242), although I think in the end, this is a problem either with jest, or with the way that addon-interactions is using jest-mock. When I've needed to use jest-mock in my own project (which does not use addon-interactions), I can make it work by using:
I think the issue is that the addon-interactions imports
Which breaks in non-node or at least non-node-pollyfilled environments, because it uses CC @yannbf, would you consider a PR to change the way interactions-addon is importing jest-mock? I've seen this come up about half a dozen times in the last few days, now. |
global
(via jest-mock)
Crikey!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.43 containing PR #17535 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
I am running alpha.45:
@shilman after digging around, it looks like maybe a tag could be cut for 761501b? |
Alphas are cut pretty regularly. If you'd like to work around it for now, you can add a <script>
window.global = window;
</script> |
@IanVS the error persists with that workaround for me—I will comment out "addon-interactions" in |
Gadzooks!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.46 containing PR #17614 that references this issue. Upgrade today to the
|
@bstro are you able to provide a reproduction? I've seen this error reported, but I'm not sure why yet. |
Can you also try adding |
Try the latest alpha of storybook, there was a recent fix that should take care of that. |
I am on the latest alpha (46), as well as the latest storybook-builder-vite (0.1.18) and the error is still present |
@bstro odd. Have you removed the cache in your node_modules as well ( |
I haven't been able to work on a reproduction yet, but I can try later this week. I did completely clear out my |
Here's a reproduction at https://github.com/bstro/storybook-jest-mock-bug-repro This is on a 100% fresh install of storybook in a brand new vite project, relatively simple to reproduce if you want to try these steps:
Node version 14.18.3, btw. |
OK, thanks for the reproduction. I've figured out what's going on. Even with the fixes I've attempted, jest-mock still internally tries to run <script>
window.global = window;
</script> It's not ideal, and we need to find a fix for new users of storybook + vite, but I think this will at least get you up and running for now. |
Egads!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.53 containing PR #17830 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.20 containing PR #17830 that references this issue. Upgrade today to the
|
It still happens with |
Yowza!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-rc.11 containing PR #21832 that references this issue. Upgrade today to the
|
Describe the bug
createed a vite / react app - added storybook:
Got an error saying I needed to add:
Finally ran:
yarn storybook
Got:
The text was updated successfully, but these errors were encountered: