Skip to content
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

spawn E2BIG #545

Open
robzarel opened this issue Feb 18, 2025 · 0 comments
Open

spawn E2BIG #545

robzarel opened this issue Feb 18, 2025 · 0 comments

Comments

@robzarel
Copy link

robzarel commented Feb 18, 2025

problem:

Error: spawn E2BIG Failed to launch browser.

using sharding in CI or "--includeTags", "--excludeTags" in new versions of @storybook/test-runner does not solve the problem.

env: @storybook/test-runner V0.13.0

reason:
@storybook/test-runner creates an environment variable STORYBOOK_STORIES_PATTERN, into which it places the contents of stories from the storybook config.
If the array of stories in your storybook config is too large, an E2BIG error may occur.

its turns out i've calculated exact path to every "stories" file (there is over 4k of them in monorepo).

solution:

you can load stories to storybook with an array of globs. In this case you can target your stories with a extglobs syntax from picomatch. Like this:

'..src/@(subdirectory)/**/*.stories.@(ts|tsx)'

When parsing such a "glob string" using picomatch, storybook will determine the "normal" part of the path and write it to 'directory', and the part containing patterns as a glob will be written to 'files'.

Storybook will parse this 'glob string' and create a StoriesSpecifier object from it using picomatch.scan.

OR you can load stories from your project with a configuration object to storybook:

{
  directory: '../src',
  files: 'subdirectory/**/*.stories.@(ts|tsx)'
}

Both ways will reduce the number of 'stories' items array, but the first way is a bit shorter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant