Skip to content

[Documentation]: Example vitest.config.ts in docs does not work with Storybook 9.0.12 and Vitest 3.2 #31815

Open
@messenjer

Description

@messenjer

Describe the problem

Hello,

I’ve been trying to follow the new Storybook 9.0.12 documentation that includes support for Vitest 3.2. Specifically, I used the example from this page, using the new projects filed from vitest 3.2:

https://storybook.js.org/docs/writing-tests/integrations/vitest-addon#example-configuration-files

However, when I run npm run test, I get the following error:

Error: Failed to import test file /home/.../.storybook/vitest.setup.ts  
Caused by: TypeError: Failed to fetch dynamically imported module: http://localhost:63315/home/..../.storybook/vitest.setup.ts?import&browserv=1750269175644

The path was correct.

I tried a clean install and noticed that the generated vitest.config.ts differs from the one shown in the documentation. In particular, the working version includes:

// inside project config
extends: true,

Adding this field resolved the issue.

To help others avoid this problem, I opened a pull request to update the documentation accordingly:
#31814

Let me know if anything else is needed. Thanks!

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions