-
Notifications
You must be signed in to change notification settings - Fork 106
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
addon-interactions: jest-mock global is not defined #186
Comments
Do you see any messages in your terminal like this?
If so, you'll need to add whatever dependencies it's finding to your |
@IanVS Awesome, ill try that and get back to you. Also ,while Im at it, is there another config in viteFinal i can add to change the asset path in the iframe? Ive done all manager-head stuff to change the base to under /storybook but with vite, assets like images etc still load under '/assets' (root).. (webpack works as expected though in this setup.) |
The I'm not certain exactly what you're describing, but maybe it's this? https://github.com/eirslett/storybook-builder-vite#note-about-working-directory. Feel free to open a new issues with some details and we can try to help out. |
@peteromano here the guide: How to enable Storybook Interactions addon with Vite builder
|
I have the same error. It's work find after install jest. |
New storybook projects created with |
My storybook setup works great until i add Interactions (with @storybook/jest):
Browser console fatal error (nothing loads):
Uncaught SyntaxError: The requested module '/node_modules/jest-mock/build/index.js?v=de720b8b' does not provide an export named 'fn'
However, adding
/register
seemed to work (based on https://stackoverflow.com/questions/68360359/storybook-addon-value-should-end-in-register-or-it-should-be-a-valid-preset):BUT trying to actually use @storybook/jest in a story doesn't work:
import { expect } from '@storybook/jest';
Gives you this error in the browser:
Uncaught ReferenceError: global is not defined at node_modules/jest-mock/build/index.js
Commenting out this in main works with a normal Interactions install:
TL;DR: So default webpack works for Interactions; Vite builder doesn't. (Other add-ons seem to work fine with vite builder btw)
The text was updated successfully, but these errors were encountered: