Skip to content

[Bug] No coverage for file reported if JSX is used  #34

Open

Description

Describe the bug

Coverage is not reported for files where JSX is used.

I've set up a minimal repository that recreates the issue with the same config - https://github.com/jMalojlo/sb-repro.
It's a basic button component with a story containing a play function to 'test' a click handler.
The component itself contains some JSX and imports some jsx and non-jsx module. What we see in the coverage report is that only the files without JSX are properly counted.
We're running an ejected CRA and I assume it's a Babel config issue, but can't figure this out myself.

Steps to reproduce the behavior

  1. Clone https://github.com/jMalojlo/sb-repro
  2. npm install && npx playwright install chrome
  3. npm run storybook
  4. npm run storybook-test runs tests with --coverage
  5. npm run generate-storybook-coverage nyc report with lcov
  6. open ./coverage/storybook/lcov-report/index.html to inspect the coverage HTML file
  7. Screenshot 2023-12-04 at 18 33 02

Environment

  • Node.js version: 20.9.0
  • NPM version: 10.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions