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: Add @vitest/coverage-v8 in postinstall if no coverage reporter installed #29993

Conversation

ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Dec 9, 2024

Closes #29797

What I did

Checks for the presence of @vitest/coverage-istanbul or @vitest/coverage-v8 and when neither is present, installs @vitest/coverage-v8 as part of the addon's postinstall hook.

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

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

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 1.48 kB -0.3 0%
initSize 133 MB 133 MB 8.66 kB 2.98 0%
diffSize 55.1 MB 55.1 MB 7.18 kB 2.96 0%
buildSize 6.87 MB 6.87 MB 3.78 kB 1.23 0.1%
buildSbAddonsSize 1.51 MB 1.51 MB 219 B 3.33 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 2.31 kB 19.19 0.1%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.57 MB 3.57 MB 2.52 kB 6.13 0.1%
buildPreviewSize 3.3 MB 3.3 MB 1.25 kB 1.15 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 7.4s 7.4s 28ms -0.52 0.4%
generateTime 21.5s 21s -469ms 0.27 -2.2%
initTime 13.5s 13.2s -306ms -0.38 -2.3%
buildTime 8.3s 8.6s 282ms -0.34 3.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.7s 4.1s -1s -556ms -1.53 🔰-37.2%
devManagerResponsive 4.2s 3.1s -1s -114ms -1.51 🔰-35.4%
devManagerHeaderVisible 576ms 475ms -101ms -1.44 🔰-21.3%
devManagerIndexVisible 677ms 536ms -141ms -1.21 -26.3%
devStoryVisibleUncached 1.9s 1.7s -203ms -0.03 -11.6%
devStoryVisible 673ms 536ms -137ms -1.16 -25.6%
devAutodocsVisible 686ms 447ms -239ms -1.08 -53.5%
devMDXVisible 562ms 420ms -142ms -1.27 🔰-33.8%
buildManagerHeaderVisible 748ms 468ms -280ms -1.22 -59.8%
buildManagerIndexVisible 757ms 555ms -202ms -1.11 -36.4%
buildStoryVisible 596ms 435ms -161ms -1.19 -37%
buildAutodocsVisible 426ms 368ms -58ms -1.37 🔰-15.8%
buildMDXVisible 510ms 354ms -156ms -1.66 🔰-44.1%

Greptile Summary

Adds automatic installation of @vitest/coverage-v8 during postinstall if no coverage reporter is detected in the Storybook test addon, improving out-of-the-box test coverage functionality.

  • Modified code/addons/test/src/postinstall.ts to check for existing coverage reporters (@vitest/coverage-v8 or @vitest/coverage-istanbul)
  • Added automatic installation of @vitest/coverage-v8 if no coverage reporter is found
  • Added informative console messaging about coverage reporter installation
  • Implemented safe installation process with dependency checks

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.

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

code/addons/test/src/postinstall.ts Show resolved Hide resolved
code/addons/test/src/postinstall.ts Show resolved Hide resolved
Copy link

nx-cloud bot commented Dec 9, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 464f367. 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.

Copy link
Contributor

@JReinhold JReinhold left a comment

Choose a reason for hiding this comment

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

Minor wording comment.

code/addons/test/src/postinstall.ts Outdated Show resolved Hide resolved
@storybook-pr-benchmarking
Copy link

storybook-pr-benchmarking bot commented Dec 9, 2024

Package Benchmarks

Commit: 464f367, ran on 10 December 2024 at 11:05:17 UTC

No significant changes detected, all good. 👏

@ghengeveld ghengeveld merged commit 2c17aef into next Dec 10, 2024
58 checks passed
@ghengeveld ghengeveld deleted the 29797-test-addon-should-install-coverage-provider-out-of-the-box branch December 10, 2024 12:03
@github-actions github-actions bot mentioned this pull request Dec 10, 2024
11 tasks
@shilman shilman changed the title Addon Test: Add @vitest/coverage-v8 during postinstall if no coverage reporter is installed Addon Test: Add @vitest/coverage-v8 in postinstall if no coverage reporter installed Dec 11, 2024
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.

Test addon should install coverage provider out of the box
2 participants