-
Notifications
You must be signed in to change notification settings - Fork 10
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] Doesn't work when Storybook is built with the new --test flag #31
Comments
Experiencing the same issue here. Did a little digging and it seems that the coverage add-on is disabled by default if not overridden? https://github.com/storybookjs/storybook/blob/00124ed94f397d2d6c0a9fa8bbad823cfa1b0ab9/code/lib/core-server/src/presets/common-override-preset.ts#L41 |
I can confirm that if you are using This should probably be fixed, but in the meantime, overriding your build configuration as such does mitigate the issue: // main.ts
{ ...,
build: {
test: {
disabledAddons: [
'@storybook/addon-docs',
'@storybook/addon-essentials/docs',
],
},
},
} To maintainers: This does seem like it was accidentally added to the block-list, I'm happy to propose a PR in the SB repo to change that if that is indeed something that shouldn't be set by default -- feels a little odd to me to disable coverage when making a test build of your storybook, which is the prime use-case for coverage. |
@otaviomad, thanks for reporting this, and also @vicrep appreciate your assistance on this 🙏 . So that you're aware, I've pushed a pull request here and will push another into the official documentation to address this until we have a proper fix. Hope you all have a great day. Stay safe |
Describe the bug
Storybook 7.6 introduced a new --test flag for building Storybook with less of the fluff that is not needed for testing environments.
When you try to run test-storybook with --coverage on a storybook that was built with --test, I get the following error:
Steps to reproduce the behavior
Expected behavior
I believe that the istanbul plugin is not being properly injected when --test is enabled. I don't get the
[addon-coverage] Adding istanbul plugin to Vite config
message when I use it. The coverage should work when --test is enabled.The text was updated successfully, but these errors were encountered: