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

Addon Test: Clarify message when vitest detects missing deps #29763

Merged
merged 3 commits into from
Dec 5, 2024

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Dec 2, 2024

Closes #29721

What I did

  • Modify the message from vitest to make the need to install some missing dependencies

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  • Set up a sandbox with the test addon
  • Neglect to install a coverage provider (v8 or instanbul)
  • Run a storybook in dev-mode
  • Configure (in the UI) to have the test addon run coverage
  • Run tests from within the UI

You should see a Crash appear in the storybook UI, which then should let you open a modal.
This modal should tell you to install the provider package.
The CLI should also tell you to install the package.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 77.7 MB 77.7 MB 2.5 kB 1.61 0%
initSize 130 MB 130 MB 2.5 kB -1 0%
diffSize 52.4 MB 52.4 MB 0 B -1 0%
buildSize 6.83 MB 6.83 MB 0 B 1.1 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B -0.74 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B 1.21 0%
buildSbPreviewSize 271 kB 271 kB 0 B -1.11 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.84 MB 3.84 MB 0 B 1.19 0%
buildPreviewSize 3 MB 3 MB 0 B 1 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7s 19.8s 12.7s 0.76 64.3%
generateTime 22.7s 24.2s 1.4s 0.17 6.1%
initTime 15.8s 16.3s 546ms 0.04 3.3%
buildTime 9s 8.2s -790ms -0.8 -9.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.8s 6.8s 2s 2.59 🔺29.4%
devManagerResponsive 3.4s 4.7s 1.2s 5.58 🔺27.1%
devManagerHeaderVisible 590ms 856ms 266ms 5.21 🔺31.1%
devManagerIndexVisible 590ms 905ms 315ms 5.5 🔺34.8%
devStoryVisibleUncached 1.8s 2.4s 640ms 2.66 🔺26.1%
devStoryVisible 748ms 893ms 145ms 4.25 🔺16.2%
devAutodocsVisible 548ms 763ms 215ms 4.06 🔺28.2%
devMDXVisible 497ms 799ms 302ms 5.12 🔺37.8%
buildManagerHeaderVisible 566ms 838ms 272ms 4.1 🔺32.5%
buildManagerIndexVisible 577ms 872ms 295ms 4.27 🔺33.8%
buildStoryVisible 560ms 836ms 276ms 4.35 🔺33%
buildAutodocsVisible 465ms 645ms 180ms 4.27 🔺27.9%
buildMDXVisible 562ms 657ms 95ms 3.01 🔺14.5%

Greptile Summary

This PR improves error handling for missing Vitest coverage dependencies in the Storybook test addon by providing clearer user guidance.

  • Fixed error detection in test-manager.ts to properly identify missing coverage packages (@vitest/coverage-v8 or @vitest/coverage-istanbul)
  • Added specific error messages in vitest-manager.ts to guide users on installing required coverage packages
  • Fixed typo in error condition check (e.mesaage -> e.message) in test-manager.ts
  • Removed debug console.log('HELLO') statement in vitest-manager.ts

@ndelangen ndelangen changed the title add exceptions amending the error message to prompt users to install required packages for supporting coverage AddonTest: Clearer message when missing deps detected by vitest Dec 2, 2024
@ndelangen ndelangen self-assigned this Dec 2, 2024
Copy link

nx-cloud bot commented Dec 2, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 07cdd5b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

@ndelangen ndelangen requested a review from JReinhold December 2, 2024 12:28
@shilman shilman changed the title AddonTest: Clearer message when missing deps detected by vitest Addon Test: Clearer message when missing deps detected by vitest Dec 2, 2024
@shilman shilman changed the title Addon Test: Clearer message when missing deps detected by vitest Addon Test: Clarify message when missing deps detected by vitest Dec 2, 2024
@shilman shilman changed the title Addon Test: Clarify message when missing deps detected by vitest Addon Test: Clarify message when vitest detects missing deps Dec 2, 2024
@ndelangen ndelangen marked this pull request as ready for review December 2, 2024 13:08
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile

code/addons/test/src/node/test-manager.ts Outdated Show resolved Hide resolved
code/addons/test/src/node/test-manager.ts Outdated Show resolved Hide resolved
code/addons/test/src/node/vitest-manager.ts Outdated Show resolved Hide resolved
@ndelangen ndelangen merged commit 4863529 into next Dec 5, 2024
60 checks passed
@ndelangen ndelangen deleted the norbert/improve-coverage-dep-missing-error branch December 5, 2024 08:54
@github-actions github-actions bot mentioned this pull request Dec 5, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gracefully handle coverage dependencies on @vitest/coverage-v8/@vitest/coverage-istanbul
2 participants