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

Gracefully handle coverage dependencies on @vitest/coverage-v8/@vitest/coverage-istanbul #29721

Closed
Tracked by #29530
JReinhold opened this issue Nov 27, 2024 · 1 comment · Fixed by #29751 or #29763
Closed
Tracked by #29530
Assignees

Comments

@JReinhold
Copy link
Contributor

JReinhold commented Nov 27, 2024

Running and enabling coverage in the testing module requires that a coverage provider package is installed. We want to handle this gracefully in multiple ways. The built-in Vitest coverage packages are @vitest/coverage-v8 and @vitest/coverage-istanbul.

  1. During npx storybook add @storybook/experimental-addon-test, we should detect if none of the built-in packages are installed, and ask the user if they want to install @vitest/coverage-v8 (as that is the default) to enable coverage in Storybook.
  2. When running SB, we should detect if the coverage provider package isn't installed. If it isn't disable the Coverage checkbox in the UI with a tooltip explaining why it can't be enabled.

The complexity here is that users can specify 'custom' coverage providers, in which case they don't need any of the two built-in packages installed. we need to handle this case in both 1 and 2.

Original discussion: https://chromaticqa.slack.com/archives/C07AXQABXDZ/p1732659153084449

@ndelangen
Copy link
Member

I'm doing a follow-up PR to improve the message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants