-
Notifications
You must be signed in to change notification settings - Fork 72
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] Coverage Report is Empty #313
Comments
First of all, I am very grateful to have Storybook as OSS and have been using it happily for a couple of years now. @jeffcap1 I really wish I could help as I myself just spent more than a couple of hours to get to the bottom of this. I used Storybook CLI to update to the latest (from v7.0.5 to v7.0.23). In my case running (https://npmjs.com/package/@storybook/test-runner) from v0.10.0 to v0.11.0. Going back to v0.10.0 fixed the problem for me. See below my final package.json diff, I am happy to say the coverage report is created. |
I just tried the same approach as @cezudas by running |
Describe the bug
Coverage report does not seem to be working in Storybook 7 with Vite. The test runner will go through and test the stories as expected, but no information is displayed in the coverage table or underlying coverage json file. I tried this on both a brand new Vite project as well as an existing Vite project I was upgrading to Storybook 7 and experienced the same issue.
To Reproduce
Steps to reproduce the behavior:
npm create vite@latest {PROJECT_NAME} -- --template react
cd {PROJECT_NAME} && npm install
npx storybook@latest init
npm install -D @storybook/test-runner @storybook/addon-coverage
npm run storybook
npx test-storybook --coverage
Expected behavior
The coverage table would show the tested components from the stories as well as the number of covered lines. The coverage/storybook/coverage-storybook.json should also be populated with information.
Screenshots
System
Environment Info:
System:
OS: macOS 13.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 16.19.1 - ~/.nvm/versions/node/v16.19.1/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 8.19.3 - ~/.nvm/versions/node/v16.19.1/bin/npm
Browsers:
Safari: 16.5
npmPackages:
@storybook/addon-coverage: ^0.0.8 => 0.0.8
@storybook/addon-essentials: ^7.0.20 => 7.0.20
@storybook/addon-interactions: ^7.0.20 => 7.0.20
@storybook/addon-links: ^7.0.20 => 7.0.20
@storybook/blocks: ^7.0.20 => 7.0.20
@storybook/react: ^7.0.20 => 7.0.20
@storybook/react-vite: ^7.0.20 => 7.0.20
@storybook/test-runner: ^0.10.0 => 0.10.0
@storybook/testing-library: ^0.0.14-next.2 => 0.0.14-next.2
The text was updated successfully, but these errors were encountered: