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: Fix generated path to vitest.setup.js #30233

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Jan 10, 2025

Closes #

What I did

Made the path generated for vitest.setup.js dynamic to match all scenarios, similar to what it already does in https://github.com/storybookjs/storybook/blob/next/code/addons/test/src/postinstall.ts/#L456-L460

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.8 MB 77.8 MB 0 B -2.12 0%
initSize 131 MB 131 MB 0 B -0.34 0%
diffSize 53 MB 53 MB 0 B -0.33 0%
buildSize 7.19 MB 7.19 MB 0 B 1.08 0%
buildSbAddonsSize 1.85 MB 1.85 MB 0 B - 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.87 MB 1.87 MB 0 B -0.82 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.91 MB 3.91 MB 0 B -0.82 0%
buildPreviewSize 3.28 MB 3.28 MB 0 B 1.09 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 11.8s 6.7s -5s -65ms -1.36 🔰-74.5%
generateTime 22.5s 21.7s -765ms 0.93 -3.5%
initTime 15.1s 15s -39ms 1.1 -0.3%
buildTime 8.2s 8.4s 131ms -1.08 1.6%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 5.2s 4.1s -1s -151ms -1.81 🔰-27.9%
devManagerResponsive 3.9s 3s -887ms -1.85 🔰-28.8%
devManagerHeaderVisible 586ms 499ms -87ms -2 🔰-17.4%
devManagerIndexVisible 613ms 531ms -82ms -1.96 🔰-15.4%
devStoryVisibleUncached 2.1s 1.7s -393ms -0.69 -21.9%
devStoryVisible 614ms 532ms -82ms -2.06 🔰-15.4%
devAutodocsVisible 549ms 514ms -35ms -0.58 -6.8%
devMDXVisible 490ms 450ms -40ms -1.48 🔰-8.9%
buildManagerHeaderVisible 530ms 527ms -3ms -0.94 -0.6%
buildManagerIndexVisible 621ms 617ms -4ms -0.93 -0.6%
buildStoryVisible 519ms 518ms -1ms -0.92 -0.2%
buildAutodocsVisible 415ms 413ms -2ms -1.4 -0.5%
buildMDXVisible 407ms 421ms 14ms -1.04 3.3%

Greptile Summary

Updates the path generation logic for vitest.setup.js in the Storybook Test addon's postinstall script to use dynamic relative paths instead of static ones.

  • Modified path resolution in code/addons/test/src/postinstall.ts to use relative() for generating vitest.setup.js paths
  • Ensures setup file is correctly referenced when creating workspace files
  • Ensures setup file is correctly referenced when creating new config files
  • Improves reliability across different project structures and configurations

@JReinhold JReinhold self-assigned this Jan 10, 2025
@JReinhold JReinhold marked this pull request as ready for review January 10, 2025 13:24
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, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@@ -444,7 +446,7 @@ export default async function postInstall(options: PostinstallOptions) {
name: 'chromium',
provider: 'playwright',
},
setupFiles: ['./.storybook/vitest.setup.ts'],
setupFiles: ['${vitestSetupFilePath}'],
Copy link
Contributor

Choose a reason for hiding this comment

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

style: setupFiles path should use posix-style forward slashes for cross-platform compatibility

Copy link

nx-cloud bot commented Jan 10, 2025

View your CI Pipeline Execution ↗ for commit f3139a9.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 1m 41s View ↗

☁️ Nx Cloud last updated this comment at 2025-01-10 13:28:48 UTC

@JReinhold JReinhold merged commit 1664776 into next Jan 13, 2025
61 of 69 checks passed
@JReinhold JReinhold deleted the jeppe/fix-vitest-setup-path branch January 13, 2025 08:59
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.

2 participants