chromaui / addon-visual-tests

Visual Tests addon for Storybook
MIT License
28 stars 1 forks source link

If `chromatic.config.json` has `storybookBuildDir` configured, a build is not triggered #323

Closed rhuanbarreto closed 6 days ago

rhuanbarreto commented 1 week ago

Describe the bug

I separately build the storybook for caching purposes in CI so we speed up the process in our monorepo. And for this I use the storybookBuildDir option in the chromatic.config.json file.

But when I push the play button in the storybook interface, the chromatic command fails:

Invalid Storybook build at storybook-static: ENOENT: no such file or directory, scandir 'storybook-static'

This is because in development, the developers don't build the storybook locally, which is fine.

I understand that the addon just delegates the build responsibility to the chromatic command. But could either the addon or the chromatic command trigger a build if there's nothing on the storybookBuildDir?

To reproduce

  1. Setup chromatic.config.json with storybookBuildDir
  2. Remove the storybookBuildDir folder if there's any
  3. Start the storybook: storybook dev -p 6006
  4. Push the play button to trigger the visual tests addon
  5. The underlying chromatic command should fail

Environment

"@chromatic-com/storybook": "1.5.0",
"@storybook/addon-designs": "8.0.2",
"@storybook/addon-essentials": "8.1.1",
"@storybook/addon-interactions": "8.1.1",
"@storybook/addon-themes": "8.1.1",
"@storybook/react": "8.1.1",
"@storybook/react-vite": "8.1.1",
rhuanbarreto commented 6 days ago

Thanks a lot for fixing this!

ghengeveld commented 4 days ago

No problem, thanks for reporting.