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: Only register testing module in Vite projects #29472

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Oct 29, 2024

Closes #

What I did

The Testing module UI will now only be registered in Vite-based projects.

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/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.6 MB 77.6 MB 76 B 0.6 0%
initSize 143 MB 143 MB 76 B -1.98 0%
diffSize 65.1 MB 65.1 MB 0 B -1.99 0%
buildSize 6.87 MB 6.87 MB 0 B -0.29 0%
buildSbAddonsSize 1.51 MB 1.51 MB 0 B -0.62 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.9 MB 1.9 MB 0 B 2.38 0%
buildSbPreviewSize 271 kB 271 kB 0 B -0.42 0%
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.88 MB 3.88 MB 0 B -0.29 0%
buildPreviewSize 3 MB 3 MB 0 B -0.65 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 20.7s 8.1s -12s -523ms -0.59 -152.8%
generateTime 24.4s 25.2s 807ms 1.82 3.2%
initTime 16.6s 16.4s -151ms 1.13 -0.9%
buildTime 7.8s 8.9s 1s -0.84 11.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.7s 5.8s 89ms -1.12 1.5%
devManagerResponsive 3.5s 3.5s 16ms -1.5 0.4%
devManagerHeaderVisible 543ms 526ms -17ms -1.11 -3.2%
devManagerIndexVisible 622ms 555ms -67ms -1.28 🔰-12.1%
devStoryVisibleUncached 1.1s 1.1s 32ms -0.13 2.7%
devStoryVisible 620ms 551ms -69ms -1.15 -12.5%
devAutodocsVisible 486ms 501ms 15ms -0.94 3%
devMDXVisible 403ms 514ms 111ms -0.76 21.6%
buildManagerHeaderVisible 526ms 574ms 48ms -0.69 8.4%
buildManagerIndexVisible 542ms 591ms 49ms -0.68 8.3%
buildStoryVisible 518ms 573ms 55ms -0.68 9.6%
buildAutodocsVisible 447ms 434ms -13ms -1.35 -3%
buildMDXVisible 434ms 454ms 20ms -0.91 4.4%

Greptile Summary

This PR modifies the test addon to conditionally enable component testing functionality only for Vite-based Storybook projects, while maintaining the UI panel for all projects.

  • Added Vite builder check globalThis.STORYBOOK_BUILDER?.includes('vite') in code/addons/test/src/manager.tsx to gate test provider registration
  • Test provider registration with TEST_PROVIDER_ID now only occurs for Vite projects
  • Panel registration with PANEL_ID remains available for all projects regardless of builder
  • Maintains backward compatibility by keeping the UI structure intact for non-Vite projects

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, 3 comment(s)
Edit PR Review Bot Settings | Greptile

message = 'Component tests failed';
} else if (crashed || (failed && errorMessage)) {
message = (
if (globalThis.STORYBOOK_BUILDER?.includes('vite')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider using a more robust check like STORYBOOK_BUILDER === '@storybook/builder-vite' instead of string includes

testResults: TestResult[];
error?: { message: string; name: string };
}>);
}

addons.add(PANEL_ID, {
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Panel is still registered even when test provider is not available, which could lead to confusing empty UI state

Copy link

nx-cloud bot commented Oct 29, 2024

☁️ Nx Cloud Report

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

@kasperpeulen kasperpeulen merged commit 694dcef into next Oct 29, 2024
59 of 60 checks passed
@kasperpeulen kasperpeulen deleted the yann/disable-testing-module-on-non-vite-projects branch October 29, 2024 13:04
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.

3 participants