-
Notifications
You must be signed in to change notification settings - Fork 72
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
[bug] Importing stories from separate packages in a monorepo no longer works with v0.14 - testMatch returns 0 matches #381
Comments
Opened this under a test Github user I had, my bad! Just to let you folks know I'm not a bot 😂 |
Hey @ahayes91 and 🤖, thank you for reporting the issue! The only actual change from that PR is this: could you please try to undo that change, in your local node_modules, and see if the issue is fixed? |
Hey there @ahayes91 I tried to make a reproduction but couldn't get it to fail. In fact, I noticed you're using NX so I set a workspace up here:
And that works correctly: I renamed the story files so that:
and every scenario worked correctly. |
No joy when I made the changes in node_modules, still failing: Anything else you could think of that I can fiddle with to try and debug this a bit? (Maybe point me towards the file internally that finds the Storybook files?) I really appreciate this definitely needs a proper reproduction, so I'll work on that now - we're using package-based Nx (a very annoying restriction on us right now due to other internal blockers) and have Storybook in its own package (so that I can put some task management around the storybook commands), so it wasn't generated in using @nx/storybook. |
In the meantime, can you remove this line of code as well? It must be the culprit |
Yes this fixes it! 💪 Edit: Sticking a debug of This bug is very specific to folks who whack Storybook into its own package in a monorepo, rather than a Is that a valid use case? I'm undecided - I really don't like our package-based architecture, but we have unrelated constraints and it works for us for now 😂 The workaround in this case would be to eject the test-runner-jest.config.js with const {getJestConfig} = require('@storybook/test-runner');
// The default configuration comes from @storybook/test-runner
const testRunnerConfig = getJestConfig();
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
...testRunnerConfig,
/** Add your own overrides below, and make sure
* to merge testRunnerConfig properties with your own
* @see https://jestjs.io/docs/configuration
*/
// Required with bug https://github.com/storybookjs/test-runner/issues/381 in v0.14.0
roots: undefined,
}; Wondering what you folks are thinking about this - is this setting of |
Hey @ahayes91! Your use case is valid, and I've seen other people do it, mostly because they do not want dependencies from Storybook to somehow get in the way from their application's dependencies. We do not recommend this as de-facto Storybook configuration because we don't use it ourselves, we don't support it as greatly (as you can see) as with basic configurations, and because there could be hoisting and other issues caused by tools like Yarn PnP and pnpm PnP. You are free to use it as you see fit, of course. Regardless, you have detected a bug from a change I did in a previous PR, so I reverted it on #387 and it's now released as a patch in 0.14.1. Please upgrade and it should all be good now, with no need to eject the test-runner config. Also, I greatly appreciate the effort you put into getting this fixed! Thank you so much and have a great week! |
Describe the bug
#339 added capability to import stories in a monorepo with a regex, but this is broken for me now in v0.14.
I worked upwards from v0.13 and identified that the breakage occurs from
0.14.0-next.3
- so it must have been introduced with the code in #376.To Reproduce
I can work on a reproduction repo for this but it might take a bit 😬 If there's a CodeSandbox template available to give me a head start that would be great 🙇
I've redacted some info from the output below, you can see we're using Nx to run the task from within a
storybook
package. This is working fine to display the stories on Storybook and the interaction addon works fine in the browser too.Expected behavior
Test runner should have found a few tests!
Screenshots
N/A
System
Additional context
Versions below
0.14.0-next.3
work fine.The text was updated successfully, but these errors were encountered: