Skip to content
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]: The code in this story is not instrumented on excluded stories #23

Open
unional opened this issue Aug 8, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@unional
Copy link

unional commented Aug 8, 2023

Describe the bug

I have some stories I want to exclude from coverage.
So I have this config:

const config = {
  addons: [{
    name: '@storybook/addon-coverage',
    options: {
      istanbul: {
        exclude: ["**/Button*"]  // <-- here
      }
    }
  }]
}

When running test-storybook --coverage,
those stories failed with:

    [Test runner] An error occurred when evaluating code coverage:
      The code in this story is not instrumented, which means the coverage setup is likely not correct.
      More info: https://github.com/storybookjs/test-runner#setting-up-code-coverage

Steps to reproduce the behavior

https://github.com/cyberuni/storybook-coverage-instrument-issue

pnpm i
pnpm storybook
pnpm test-storybook --coverage # another terminal

Expected behavior

Those stories should be excluded from the coverage and should not fail.

Screenshots and/or logs

image

Environment

  • OS: Windows 11
  • Node.js version: v18.12.1
  • PNPM version: 7.18.0

Additional context

@unional unional added the bug Something isn't working label Aug 8, 2023
@OmarioHassan
Copy link

Is there anyone still alive here

@chortis
Copy link

chortis commented Jul 29, 2024

Is there anyone still alive here

Old, but the way I got around this was to use --excludeTags (or --includeTags) and add tags to what is not covered. The tests will skip (this was fine in our case), but to get around that you could do a separate run without the coverage flag on those tests and use --includeTags.

I agree it sucks though, it should still run the tests with a possible warning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants