Storybook Vitest much slower on CI compared to Test Runner #32170
Replies: 1 comment
-
You don't need to build Storybook in advance for Vitest tests on CI—the standard approach is to run Vitest directly, just like you would locally, and the official docs and example CI configs don't include a Storybook build step for this workflow (docs). Slower performance with Vitest on CI is usually due to async rendering and the need for explicit waits in your tests. Unlike the legacy test runner, Vitest doesn't have a built-in global DOM readiness hook, so you need to use async Testing Library queries (like Other common causes of slowdowns include complex or duplicated Vite/Vitest config, plugin duplication, or lack of caching. For best results, make sure your Vite config is merged properly (especially if you have multiple Vitest projects), avoid duplicating plugins, and keep your coverage include/exclude patterns consistent. If you have a complex setup, isolating test config in a separate If you want to optimize further, check your CI resource allocation and consider using Vitest's parallelization and caching features. But fundamentally, robust async handling in your tests is the most important factor for reliable and performant CI runs with Storybook + Vitest. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I've been trying to migrate our monorepo to Vitest for storybook instead of the test runner, but so far it seems far slower than the test runner was. The docs don't suggest so, but should I be building the storybook in advance or anything like that?
Additional information
No response
Create a reproduction
No response
Beta Was this translation helpful? Give feedback.
All reactions