Skip to content

Conversation

@kylegach
Copy link
Contributor

@kylegach kylegach commented Aug 8, 2025

What I did

Per Vitest docs, two changes:

  1. Place extends property in correct location
  2. Wrap project config in defineProject for better type-safety

Checklist for Contributors

Testing

Manual testing

  1. Sync this branch with locally running docs

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.

Greptile Summary

This PR fixes critical documentation errors in the Vitest configuration examples for the @storybook/addon-vitest package. The changes address two key issues that would cause configuration failures for users copying the examples:

  1. Corrected extends property placement: The extends: true property was incorrectly placed at the root test configuration level. According to Vitest documentation, when using project configurations with defineProject, the extends property must be placed inside the project configuration object, not at the root level.

  2. Added missing defineProject import: The Vue and Svelte configuration examples were using the defineProject function without importing it. This function provides better type safety for project configurations and must be imported from vitest/config.

The fix updates the documentation snippets in docs/_snippets/vitest-plugin-vitest-config.md to align with official Vitest documentation patterns. This ensures users can successfully copy and use the configuration examples without encountering TypeScript errors or runtime configuration issues. The changes affect three framework examples (React, Vue, and Svelte), making the documentation consistent and functional across all supported frameworks.

Confidence score: 5/5

  • This PR is extremely safe to merge with no risk of breaking changes
  • Score reflects simple documentation fixes that align with official Vitest standards
  • No files require special attention as this is purely documentation correction

@kylegach kylegach self-assigned this Aug 8, 2025
@kylegach kylegach requested a review from jonniebigodes as a code owner August 8, 2025 21:16
@kylegach kylegach added documentation patch:yes Bugfix & documentation PR that need to be picked to main branch ci:docs Run the CI jobs for documentation checks only. labels Aug 8, 2025
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 reviewed, no comments

Edit Code Review Bot Settings | Greptile

@nx-cloud
Copy link

nx-cloud bot commented Aug 8, 2025

View your CI Pipeline Execution ↗ for commit 49a8e30

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

☁️ Nx Cloud last updated this comment at 2025-08-08 21:40:35 UTC

* next: (533 commits)
  Update skipPaths in copyAllStaticFiles to use outputDir for correct file handling
  Fix skipPaths in copyAllStaticFilesRelativeToMain to reference outputDir instead of targetPath
  auto trigger canary release based on branch name
  bust cache
  Refactor imports across multiple files to use named import for 'ts-dedent' for consistency and clarity
  reduce size of
  remove flaky story capture
  Refactor mocking utilities to enhance path resolution
  fix unit test
  Refactor imports in various files to include isCI and optionalEnvToBoolean for improved configuration handling
  Add new error classes for global settings and CommonJS config support
  Refactor CircleCI configuration to streamline job definitions and improve readability
  Update CHANGELOG.md for v9.1.2 [skip ci]
  Bump version from "9.2.0-alpha.2" to "9.2.0-alpha.3" [skip ci]
  Write changelog for 9.2.0-alpha.3 [skip ci]
  make RN sandboxes use src/stories directory
  Docs: Move button in ArgsTable heading to fix screenreader announcements
  Docs: Fix preview examples imports
  Docs: Fix incorrect CSF constructs
  Fix "Cannot read properties of undefined (reading 'push')"
  ...
@kylegach kylegach merged commit fd90530 into next Aug 18, 2025
5 checks passed
@kylegach kylegach deleted the docs-addon-vitest-config-typo branch August 18, 2025 21:12
@ndelangen ndelangen changed the title Docs: Fix incorrect Vitest config snippet Addon-Vitest: Fix incorrect Vitest config snippet Aug 20, 2025
ndelangen pushed a commit that referenced this pull request Aug 20, 2025
Docs: Fix incorrect Vitest config snippet
(cherry picked from commit fd90530)
ndelangen pushed a commit that referenced this pull request Aug 20, 2025
Docs: Fix incorrect Vitest config snippet
(cherry picked from commit fd90530)
ndelangen pushed a commit that referenced this pull request Aug 21, 2025
Docs: Fix incorrect Vitest config snippet
(cherry picked from commit fd90530)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Aug 21, 2025
@ndelangen ndelangen removed the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:docs Run the CI jobs for documentation checks only. documentation patch:done Patch/release PRs already cherry-picked to main/release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants