Workers SDK Issue Reports

← Back to Dashboard

#9381 Can't use vitest-pool-workers with vite-plugin

Recommendation:KEEP OPEN
Difficulty:hard
Reasoning:

Assets don't exist until Vite builds. Workarounds documented. Long-term: rebuild vitest on vite-plugin.

Suggested Action:

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 assets property in your configuration is missing the required directory property"
  • Maintainer @jamesopstad explained: static assets don't exist until Vite builds the application
  • Workarounds provided:
    1. Build with Vite before running tests, point configPath to built ./dist/worker_name/wrangler.json
    2. Override test.poolOptions.workers.miniflare.assets if you don't need assets in tests
  • 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.

Add Note