chromaui / addon-visual-tests

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

NODE_ENV option #291

Closed AmirL closed 2 months ago

AmirL commented 2 months ago

Describe the bug

My storybook renders well when NODE_ENV is development, but it fails when it's production. (Mock functions obviously don't work in the production mode). There is option for NODE_ENV in the GitHub action: STORYBOOK_NODE_ENV, but I don't see any mentions of such option for the addon. an

To reproduce

Just try to write a storybook that fails in production mode (throw an error, for example, depends on NODE_ENV).

Environment

Node v18.17.1

rChaoz commented 2 months ago

I've also had this issue and I fixed it by changing the build command for storybook in my package.json:

{
  "scripts": {
    "build-storybook": "NODE_ENV=development storybook build -o build/storybook/",
  }
}

Chromatic seemed to respect that.

AmirL commented 2 months ago

Awesome, it works! Thank you @rChaoz!