You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to Cloudflare's documentation on Node.js compatibility (link), setting the compatibility flag to nodejs_compat_v2 should enable compatibility behavior equivalent to nodejs_compat as long as the compatibility date is September 23, 2024, or later. However, using nodejs_compat_v2 results in compatibility issues with Vitest integration in my project, causing the following error during testing:
Error Log
Error: In project vitest.config.mts's configuration file wrangler.toml, `compatibility_flags` must contain "nodejs_compat".
This flag is required to use `@cloudflare/vitest-pool-workers`.
❯ assertCompatibilityFlagEnabled ...
Observed Behavior
When using nodejs_compat_v2, Vitest testing fails with a compatibility_flags error indicating that nodejs_compat is required. Switching back to nodejs_compat resolves this error, but it contradicts the expected functionality stated in the documentation.
Expected Behavior
With nodejs_compat_v2 set as the compatibility flag, tests should pass successfully without requiring nodejs_compat.
Steps to Reproduce
Set compatibility flag to nodejs_compat_v2 in wrangler.toml with a compatibility date after September 23, 2024.
Run tests using @cloudflare/vitest-pool-workers.
Observe the compatibility error.
This issue seems to be tied to the interaction between nodejs_compat_v2 and Vitest's Cloudflare integration package.
Using vars defined in .dev.vars
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: In project vitest.config.mts's configuration file wrangler.toml, `compatibility_flags` must contain "nodejs_compat".This flag is required to use `@cloudflare/vitest-pool-workers`. ❯ assertCompatibilityFlagEnabled node_modules/.store/@cloudflare-vitest-pool-workers-virtual-36b606629f/package/dist/pool/index.mjs:1155:11 ❯ buildProjectWorkerOptions node_modules/.store/@cloudflare-vitest-pool-workers-virtual-36b606629f/package/dist/pool/index.mjs:1178:3 ❯ buildProjectMiniflareOptions node_modules/.store/@cloudflare-vitest-pool-workers-virtual-36b606629f/package/dist/pool/index.mjs:1294:47 ❯ getProjectMiniflare node_modules/.store/@cloudflare-vitest-pool-workers-virtual-36b606629f/package/dist/pool/index.mjs:1321:21 ❯ Object.runTests node_modules/.store/@cloudflare-vitest-pool-workers-virtual-36b606629f/package/dist/pool/index.mjs:1595:26 ❯ executeTests node_modules/.store/vitest-virtual-7eb2413551/package/dist/chunks/resolveConfig.DPmbhVlP.js:7678:5 ❯ node_modules/.store/vitest-virtual-7eb2413551/package/dist/chunks/cli-api.CKrRYkw8.js:10800:9 ❯ Vitest.runFiles node_modules/.store/vitest-virtual-7eb2413551/package/dist/chunks/cli-api.CKrRYkw8.js:10820:12 ❯ Vitest.start node_modules/.store/vitest-virtual-7eb2413551/package/dist/chunks/cli-api.CKrRYkw8.js:10663:7⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Test Files no tests Tests no tests Errors 1 error Start at 13:19:48 Duration 435ms (transform 0ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms) FAIL Tests failed. Watching for file changes... press h to show help, press q to quit[vpw:dbg] Shutting down runtimes...
The text was updated successfully, but these errors were encountered:
Which Cloudflare product(s) does this pertain to?
Wrangler, Workers Vitest Integration
What version(s) of the tool(s) are you using?
3.84.1 [Wrangler], 2.1.4 [Vitest], 0.5.24 [@cloudflare/vitest-pool-workers], 4.5.1 [yarn], 5.6.3 [typescript]
What version of Node are you using?
20.11.1
What operating system and version are you using?
macOS Sequoia 15.1 (24B83)
Describe the Bug
Describe the Bug
According to Cloudflare's documentation on Node.js compatibility (link), setting the compatibility flag to
nodejs_compat_v2
should enable compatibility behavior equivalent tonodejs_compat
as long as the compatibility date is September 23, 2024, or later. However, usingnodejs_compat_v2
results in compatibility issues with Vitest integration in my project, causing the following error during testing:Error Log
Observed Behavior
When using
nodejs_compat_v2
, Vitest testing fails with acompatibility_flags
error indicating thatnodejs_compat
is required. Switching back tonodejs_compat
resolves this error, but it contradicts the expected functionality stated in the documentation.Expected Behavior
With
nodejs_compat_v2
set as the compatibility flag, tests should pass successfully without requiringnodejs_compat
.Steps to Reproduce
nodejs_compat_v2
inwrangler.toml
with a compatibility date after September 23, 2024.@cloudflare/vitest-pool-workers
.This issue seems to be tied to the interaction between
nodejs_compat_v2
and Vitest's Cloudflare integration package.Please provide a link to a minimal reproduction
https://github.com/ZL-Asica/KumoAuth
Please provide any relevant error logs
The text was updated successfully, but these errors were encountered: