Support Vitest 4 in @cloudflare/vitest-pool-workers #11632
Draft
+3,078 −5,130
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Fixes #11064
Fixes #8369 (
defineWorkersConfigis removed)Fixes #7795 (everything is now encapsulated in a plugin, and so this type of configuration problem is impossible)
Fixes #7339 (we no longer recommend importing
envfromcloudflare:test. Instead, importenvfromcloudflare:workersand usewithEnvto override the value: https://developers.cloudflare.com/workers/runtime-apis/bindings/#overriding-env-values)Fixes #10260 (tests added to verify the mentioned libraries can be imported)
This a major breaking change to the
@cloudflare/vitest-pool-workersintegration in order to support Vitest v4. Along with supporting Vitest v4 (and dropping support for Vitest v2 and v3), we've made a number of changes that may require changes to your tests. Our aim has been to improve stability & the foundations of@cloudflare/vitest-pool-workersas we move towards a v1 release of the package.We've made a codemod to make the migration easier:
wrangler codemod vitest-pool-v3-to-v4, which will make the required changes to your config file.A picture of a cute animal (not mandatory, but encouraged)