Skip to content

Addon Test: Clear coverage data when starting or watching#30072

Merged
ghengeveld merged 19 commits intonextfrom
clear-coverage-on-start
Dec 17, 2024
Merged

Addon Test: Clear coverage data when starting or watching#30072
ghengeveld merged 19 commits intonextfrom
clear-coverage-on-start

Conversation

@ghengeveld
Copy link
Member

@ghengeveld ghengeveld commented Dec 16, 2024

Supersedes #30062

What I did

This clears the coverage data when starting a new test run or enabling watch mode, in order to prevent stale coverage data from lingering.

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 0 B 1.11 0%
initSize 136 MB 136 MB 0 B 1.11 0%
diffSize 58.4 MB 58.4 MB 0 B 1.11 0%
buildSize 7.24 MB 7.24 MB 0 B 0.9 0%
buildSbAddonsSize 1.88 MB 1.88 MB 0 B 0.9 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.86 MB 1.86 MB 0 B 0.83 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.93 MB 3.93 MB 0 B 0.9 0%
buildPreviewSize 3.3 MB 3.3 MB 0 B 0.89 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 8s 25.5s 17.4s 1.37 🔺68.5%
generateTime 20.2s 21.7s 1.5s 1.11 7%
initTime 14.5s 15.4s 878ms 0.96 5.7%
buildTime 11.9s 10.7s -1s -114ms 0.71 -10.3%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.6s 4.8s -824ms -0.52 -17.1%
devManagerResponsive 4.1s 3.5s -615ms -0.71 -17.3%
devManagerHeaderVisible 748ms 667ms -81ms 0.92 -12.1%
devManagerIndexVisible 770ms 702ms -68ms 0.75 -9.7%
devStoryVisibleUncached 1.9s 1.8s -133ms 0.24 -7.2%
devStoryVisible 792ms 703ms -89ms 0.72 -12.7%
devAutodocsVisible 501ms 605ms 104ms 1.41 🔺17.2%
devMDXVisible 578ms 637ms 59ms 1.34 🔺9.3%
buildManagerHeaderVisible 642ms 660ms 18ms 0.94 2.7%
buildManagerIndexVisible 744ms 788ms 44ms 1.24 🔺5.6%
buildStoryVisible 603ms 593ms -10ms 0.71 -1.7%
buildAutodocsVisible 504ms 577ms 73ms 2.51 🔺12.7%
buildMDXVisible 475ms 564ms 89ms 1.69 🔺15.8%

Greptile Summary

Based on the provided files and changes, I'll create a concise summary of this PR:

This PR enhances the test addon to clear coverage data when starting new test runs or enabling watch mode, preventing stale coverage information from persisting between test sessions.

  • Modified code/addons/test/src/manager.tsx to properly clear coverage data on test start/watch
  • Updated test coverage documentation in docs/writing-tests/test-coverage.mdx with Vitest 3.0.0 references
  • Added Vite dependency optimization for test packages in test-storybooks/portable-stories-kitchen-sink/react/.storybook/main.ts
  • Improved error handling in scripts/task.ts with helpful task name suggestions
  • Added useLegacyCache: "true" to code/nx.json for build system compatibility

@nx-cloud
Copy link

nx-cloud bot commented Dec 16, 2024

☁️ Nx Cloud Report

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

@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.

102 file(s) reviewed, 13 comment(s)
Edit PR Review Bot Settings | Greptile

@ghengeveld ghengeveld merged commit 91d1b03 into next Dec 17, 2024
@ghengeveld ghengeveld deleted the clear-coverage-on-start branch December 17, 2024 19:57
Copilot AI added a commit to yannbf/storybook that referenced this pull request Mar 6, 2026
…ort when content is tall

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: yannbf <1671563+yannbf@users.noreply.github.com>
Copilot AI added a commit to yannbf/storybook that referenced this pull request Mar 6, 2026
…ort + add E2E test + update skill docs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: yannbf <1671563+yannbf@users.noreply.github.com>
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.

7 participants