-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
TypeError: require(...) is not a function in initStoryshots() #10351
Comments
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Same issue. Mine throws a TypeError:
|
I am seeing this issue too.
|
I was able to fix this on my install. It was happening because I had While this is fixed in #10642 and part of a beta release for now I downgraded my jest — |
Downgrading Jest did not fix this for me. Note that this problem seems to happen in 5.3.x when using |
I've been fighting this all week and it's doing my head in. 😭 I've moved all my stories and components into a brand new Storybook + CRA repo. Things I've tried/done -
This is blocking me from upgrading to 5.3 and I'm really frustrated at this point, not sure what else to try and I can't even really troubleshoot the error because the stack trace is so vague:
|
@Aendrew i'm on the hook for releasing a 5.3.x that supports Jest 26. I've been slammed so I haven't gotten to it yet, but I'll see what I can do now. |
Hmm. I just tried upgrading 5.3 to Jest 26 and everything seems to be broken. My advice is to upgrade to SB6. We're in Beta now and making good progress towards an RC... |
Can't you just change |
@testerez If somebody wants to create a working PR to |
FWIW, I upgraded to It seems to try to configure all the loaders in order before selecting the relevant one, which is why it's failing on the Angular preset. When I initially didn't have anything modifying my Babel config as per this line:
I've since tried installing babel-plugin-require-context-hook manually and adding it to Babel config, to no avail. I'm using |
@Hypnosphi any chance you can help out @Aendrew with this? it sounds frustrating, but i don't know enough about this stuff to make a good suggestion |
@bannndi I've tried that and Currently on |
I've tried upgrading to
not sure if it's caused by the same problem. Tried both jest 25 and 26. |
@AnnaYuS managed to fix that issue by adding the following configuration to module.exports = {
...
+ transformIgnorePatterns: ['node_modules/(?!(@storybook/addon-storyshots)/)'],
} Looks like something might be off with the way that |
I was getting similar error
[edit] |
Rolling back to Jest@25 solved the issue for me. |
After rolling back to 25 I see this
|
Ran into the same error with
Fixed it by downgrading to |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Up |
In my jest config, setting |
Thanks @calumbutler for this workaround. |
It finally worked with
|
Hello again! I've been fighting this all afternoon. Let me take you on a j o u r n e y . . .
...Even when not doing anything with Storyshots:
In Jest 26, this passes, but throws a deprecation error:
However, if I change the Carrying on, let's stay with Jest 26 and use the --- a/package.json
+++ b/package.json
@@ -8,7 +8,7 @@
"license": "ISC",
"jest": {
- "browser": true,
+ "resolver": "browser-resolve",
"verbose": true,
"transform": {
@@ -79,27 +79,30 @@
+ "browser-resolve": "^2.0.0", Well, that didn't work:
I'm led to believe this is because the Jest error about Lo' and behold, if I create a file called "resolver.js" and set jest.resolver to "./resolver.js", it passes! 🎉 Wicked! Let's try it with Storyshots instead of my stub test! Er, still no. 😭
Oh bloody hell, now
To heck with Following what they've done in Marko's config, I've installed
...and returned to the basic test instead of Storyshots. Woo! Passes! Let's resurrect Storyshots!
Ah damn. Back to this. 😭 What if I alias
Ah-ha! This seems to work, I guess? However, now I'm getting lots of weird warnings like:
Opening that story in Storybook works fine. I also get a boatload of
Also:
I am so, so, so lost at this point. I'll try again at this point tomorrow, but I'm besides myself what's going on. Following versions of everything:
|
Update: Okay, I solved it. @storybook/core/dist/client/preview/loadCsf.js, ln. 149:
Once I replaced
Everything works now. I feel very face-palm-y now. tl;dr — please stop using |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
I think it's not stale :( |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
this is not stale |
If you want this fixed, please upvote by adding a 👍 to the issue description. We use this to help prioritize! |
@shilman It sure is a great feature GitHub added to help reduce issue noise… which unfortunately is completely undone when people use stale bot, which doesn't notice or care about them at all and forces users to focus on making comments to shoo it away, instead of just using the reactions… 😞 |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
Thanks, helped in my case! |
The future of storyshots is the test-runner: And use the play function for expectations: We will not be making any improvement / changes to storyshots. |
Describe the bug
I'm using storybook/vue and trying to run jest tests and generate snapshots with Storyshots but I'm getting
TypeError: require(...) is not a function
wheninitStoryshots()
is called.To Reproduce
Follow the instructions on using Storyshots with storybook/vue
Code snippets
This is the jest config that i'm using:
System:
System:
OS: macOS 10.15.4
CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
Binaries:
Node: 10.15.1 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.163
Firefox: 74.0
Safari: 13.1
npmPackages:
@storybook/addon-actions: ^5.3.14 => 5.3.14
@storybook/addon-docs: ^5.3.14 => 5.3.14
@storybook/addon-knobs: ^5.3.14 => 5.3.14
@storybook/addon-links: ^5.3.14 => 5.3.14
@storybook/addon-storyshots: ^5.3.18 => 5.3.18
@storybook/addon-storysource: ^5.3.14 => 5.3.14
@storybook/vue: ^5.3.14 => 5.3.14
The text was updated successfully, but these errors were encountered: