Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: npm test fails on fresh hello world create cloudflare project #7815

Open
irvinebroque opened this issue Jan 18, 2025 · 3 comments
Open
Labels
bug Something that isn't working

Comments

@irvinebroque
Copy link
Contributor

irvinebroque commented Jan 18, 2025

Which Cloudflare product(s) does this pertain to?

C3 (npm create cloudflare), Wrangler, Workers Vitest Integration

What versions are you using?

Wrangler 3.103.2
C3 10.9.2
"@cloudflare/vitest-pool-workers": "^0.5.2",

What operating system and version are you using?

Mac latest

Please provide a link to a minimal reproduction

https://github.com/irvinebroque/vitest-breakpoint

Describe the Bug

  1. npm create cloudflare@latest
  2. Hello World + TypeScript
  3. cd project directory
  4. npm test
  5. Observe error
➜  vitest-breakpoint git:(main) npm run test

> [email protected] test
> vitest


 DEV  v2.1.8 /Users/brendan/src/proj/vitest-breakpoint


⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ 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.json, `compatibility_flags` must contain one of "nodejs_compat"/"nodejs_compat_v2".
Either one of these flags is required to use `@cloudflare/vitest-pool-workers`.
 ❯ buildProjectWorkerOptions node_modules/@cloudflare/vitest-pool-workers/dist/pool/index.mjs:1270:13
 ❯ buildProjectMiniflareOptions node_modules/@cloudflare/vitest-pool-workers/dist/pool/index.mjs:1382:47
 ❯ getProjectMiniflare node_modules/@cloudflare/vitest-pool-workers/dist/pool/index.mjs:1409:21
 ❯ Object.runTests node_modules/@cloudflare/vitest-pool-workers/dist/pool/index.mjs:1683:26
 ❯ executeTests node_modules/vitest/dist/chunks/resolveConfig.RxKrDli4.js:7680:5
 ❯ node_modules/vitest/dist/chunks/cli-api.C2yC_ESk.js:10798:9
 ❯ Vitest.runFiles node_modules/vitest/dist/chunks/cli-api.C2yC_ESk.js:10820:12
 ❯ Vitest.start node_modules/vitest/dist/chunks/cli-api.C2yC_ESk.js:10662:7
 ❯ startVitest node_modules/vitest/dist/chunks/cli-api.C2yC_ESk.js:11828:7

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯

 Test Files  no tests
      Tests  no tests
     Errors  1 error
   Start at  09:33:12
   Duration  407ms (transform 0ms, setup 0ms, collect 0ms, tests 0ms, environment 0ms, prepare 0ms)

refs #7388 ?

Pretty sure this is happening because npm create cloudflare@latest is not installing latest version of the vitest-pool-workers package

@irvinebroque irvinebroque added the bug Something that isn't working label Jan 18, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 18, 2025
@irvinebroque
Copy link
Contributor Author

The actual version of vitest-pool-workers that is getting installed on fresh npm create cloudflare@latest is 0.5.41 rather than latest version we have published? 0.64 (link)

    "node_modules/@cloudflare/vitest-pool-workers": {
      "version": "0.5.41",

@irvinebroque
Copy link
Contributor Author

Yep everything passes soon as I pin.

@irvinebroque
Copy link
Contributor Author

I gather from #7742 that we don't automate updating dependency versions for C3 templates and can get behind.

I think if we did — then this issue possibly wouldn't have happened, since templates would already automatically start using latest published version? A good prevents?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant