Cannot find module 'cloudflare:test' or its corresponding type declarations
I created a project with the bun hono template and installed @Cloudflare/vitest-pool-workers. Afterwards, the test code was not able to find the module.
4 Replies
What does your root tsconfig look like? Can you share a repo if possible?
https://github.com/EasyDevv/bun-hono-cloudflare-vitests
files I added
- ./vitest.config.ts
- ./tests/tsconfig.json
- ./tests/indext.test.ts
Above are the repositories and the commands I used.
Adding @Cloudflare/vitest-pool-workers to the root tsconfig.json types made the error go away, but I don't know if that's the right way to do it.
GitHub
GitHub - EasyDevv/bun-hono-cloudflare-vitests
Contribute to EasyDevv/bun-hono-cloudflare-vitests development by creating an account on GitHub.
Add the following to your root
tsconfig.json
:
Here's an example one of my projects where this is setup and working, if it helps: https://github.com/Cherry/ShareX-R2-Cloudflare-Workers/tree/mainThank you !