Closed vstanciu47 closed 1 month ago
Hi @vstanciu47
Thank you for reporting the issue.
I have prepared a canary release for Storybook, which might fix the issue. Could you please try it out?
npx storybook@0.0.0-pr-27171-sha-f81ba26a upgrade
Also please install the following version for @storybook/addon-coverage
: 1.0.4--canary.42.041aa23.0
npx storybook@0.0.0-pr-27171-sha-f81ba26a upgrade
Thanks for your reply. Unfortunately the fix is not working for me. What has change is that now story files are included in the coverage report, but I don't think that is necessary. Components files are still not included in the report. Card report before canary release Card report with canary release
I also tried a fresh install of storybook with a new repository and the components are still not included in the coverage report.
Could you provide this sample repository?
I figured out what was wrong and fixed the issue on my side. It was because of .nycrc file. It basically told the tests to look for coverage in all the .ts files, but the problem was that my components library wasn't imported in storybook with the ts files, we actually build the library into a package and imported that in storybook. It was imported in preview.js as a js file. Removing .nycrc made all the components appear in the test coverage report
Describe the bug
We updated our project to storybook 8 using the migration tool. Storybook 8 is fine, the tests are running perfectly as before, but the code coverage has dropped considerably. The issue is that our components files are not getting picked up by the coverage report, but strangely enough we get helper files like enums in our coverage report.
storybook main.cjs file:
module.exports = { stories: [ '../stories/*.mdx', '../stories/update-guide/*.mdx', '../stories/theming.stories.ts', '../src/**/*.@(mdx|stories.ts)', ], addons: [ '@etchteam/storybook-addon-css-variables-theme', '@storybook/addon-a11y', '@storybook/addon-actions', { name: '@storybook/addon-coverage', options: { istanbul: { include: ['src/**/*.ts'], exclude: [ 'src/tree-view/events/**ts', 'src/tree-view/helpers/**.ts', 'src/common/mixins/**.ts', ], }, }, }, '@storybook/addon-essentials', '@storybook/addon-interactions', '@storybook/addon-links', 'storybook-addon-pseudo-states', '@storybook/addon-mdx-gfm', '@storybook/addon-webpack5-compiler-babel', ], staticDirs: ['../stories/assets', '../themes'], features: { interactionsDebugger: true, }, framework: { name: '@storybook/web-components-webpack5', options: {}, }, docs: {},
.nycrc.json file:
{ "include": [ "src/**/*.ts" ] }
To Reproduce
Use storybook web components 7 and set up interaction tests. Upgrade to storybook 8. The coverage report will not include the components file
System
Additional context
No response