Skip to content

spawn E2BIG #545

@robzarel

Description

@robzarel

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions