#9381 Can't use vitest-pool-workers with vite-plugin
Assets don't exist until Vite builds. Workarounds documented. Long-term: rebuild vitest on vite-plugin.
Track as limitation; document workarounds; long-term architectural fix needed
Analysis Report
Issue Review: cloudflare/workers-sdk#9381
Summary
Cannot use vitest-pool-workers with the new Cloudflare Vite plugin - fails with missing assets.directory error.
Findings
- Created: 2025-05-27
- Updated: 2025-06-02
- Version: wrangler 4.16 → 4.61.0, vite-plugin (various)
- Component: vitest-pool-workers, vite-plugin
- Labels: bug, vitest, vite-plugin
- Comments: 1
Key Evidence
- Attempting to use vitest-pool-workers on a CF vite project fails with "Error: The
assetsproperty in your configuration is missing the requireddirectoryproperty" - Maintainer @jamesopstad explained: static assets don't exist until Vite builds the application
- Workarounds provided:
- Build with Vite before running tests, point configPath to built
./dist/worker_name/wrangler.json - Override
test.poolOptions.workers.miniflare.assetsif you don't need assets in tests
- Build with Vite before running tests, point configPath to built
- Long-term plan: rebuild Vitest integration on top of Cloudflare Vite plugin (big chunk of work)
Recommendation
Status: KEEP OPEN
Reasoning: Valid compatibility issue between vitest-pool-workers and vite-plugin. Workarounds exist but require extra setup. Maintainer acknowledged and explained the architectural limitation. Long-term fix planned but not imminent.
Action: Track as known limitation. Consider improving documentation for using vitest-pool-workers with Vite projects. The long-term solution is rebuilding vitest integration on vite-plugin foundation.
Suggested Comment
N/A - Maintainer already provided detailed workarounds and explanation.
Notes & Feedback (0)
No notes yet.