storybookjs / addon-coverage

MIT License
19 stars 9 forks source link

[Bug] No Coverage is tracked #30

Open ian-infogrid opened 9 months ago

ian-infogrid commented 9 months ago

Describe the bug

I'm using a pretty much vanilla create-react-app with Storybook v7 initialised and I can't get code coverage to record anything at all.

Steps to reproduce the behavior

To make this easy, I've shared a small repository all stood up ready to go:

  1. git clone git@github.com:aquicore/chromatic-demo.git
  2. Open the terminal and cd chromatic-demo
  3. npm install
  4. npm run storybook
  5. (You may need to npx install playwright
  6. (Separate terminal) npm run storybook-coverage

Expected behavior

I would expect for the Button.jsx file to have a fairly high coverage reported in the terminal in in the output file.

Screenshots and/or logs

image

Environment

Additional context

I've tried tweaking various things all over the place. The culprit I thought most likely was either something in react-app (I tried ejecting but it didn't do much with babel) or the fact I'm using @storybook/react-vite as the framework, but @storybook/react-webpack5 didn't appear to do anything either.

designbyadrian commented 7 months ago

Same issue with @storybook/test-runner 0.16.0 @storybook/addon-coverage 1.0.0 and other storybook addons at 7.6 or higher.

kaidjohnson commented 2 months ago

I think this issue is similar to #34.

See https://github.com/storybookjs/addon-coverage/issues/34#issuecomment-2163404175 for possible solution