#8369 type error with `defineWorkersConfig` using vitest workspace
Valid bug. TypeScript type error when using `workspace` config with `defineWorkersConfig`. PR #11632 (Vitest 4 support) explicitly fixes this by removing `defineWorkersConfig` entirely. PR is still OPEN.
No action - awaiting PR #11632 merge which will close this issue
Analysis Report
Issue #8369: Type error with defineWorkersConfig using vitest workspace
Summary
| Field | Value |
|---|---|
| Issue | #8369 |
| Title | BUG: type error with defineWorkersConfig using vitest workspace |
| State | OPEN |
| Created | 2025-03-06 |
| Updated | 2025-10-30 |
| Labels | bug, vitest |
| Reporter Version | @cloudflare/vitest-pool-workers@0.7.6 |
| Current Version | @cloudflare/vitest-pool-workers@0.12.6 |
Problem Description
The user reports a TypeScript type error when using the workspace configuration option with defineWorkersConfig in the Vitest pool workers integration. The error indicates that the workspace field is not recognized in the type definition, as the package only updates the test type but not the top-level configuration options like workspace.
Analysis
Fix Status
A fix is in progress via PR #11632 - "Support Vitest 4 in @cloudflare/vitest-pool-workers"
The PR explicitly lists this issue as one of the fixes:
Fixes https://github.com/cloudflare/workers-sdk/issues/8369 (
defineWorkersConfigis removed)
Solution Approach
The fix is part of a breaking change for Vitest 4 support. Rather than fixing the type definitions for defineWorkersConfig, the entire function is being removed. The new approach:
- Everything is encapsulated in a Vitest plugin
- This eliminates the type configuration problem entirely
- A codemod will be provided:
wrangler codemod vitest-pool-v3-to-v4
PR Status
- PR #11632: OPEN (not yet merged)
- The PR is a significant breaking change that drops support for Vitest v2 and v3
- It includes several other breaking changes to storage isolation, test imports, and mock patterns
Changelog Check
Issue #8369 is not mentioned in the current changelog, confirming the fix has not yet been released.
Recommendation
KEEP OPEN - The issue is valid and has an active, unmerged PR (#11632) that will resolve it. The fix is part of a larger breaking change for Vitest 4 support. Once PR #11632 is merged and released, this issue should be closed automatically.
Workaround
Users experiencing this issue can:
- Avoid using the
workspaceconfiguration withdefineWorkersConfig - Use separate config files for workspace projects
- Wait for the Vitest 4 update which will resolve this by removing
defineWorkersConfigentirely
Evidence
- PR #11632 body explicitly states: "Fixes https://github.com/cloudflare/workers-sdk/issues/8369 (
defineWorkersConfigis removed)" - The PR is still open and actively being worked on
- No changelog entry exists for this issue yet
Notes & Feedback (0)
No notes yet.