cloudflare:test is not resolved when using @cloudflare/vitest-pool-workers in compilerOptions.types

Open Beginner friendly
#30,069 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
documentation

Research direction

Review the two linked Vitest integration pages, especially the compilerOptions.types examples and the sections that import from cloudflare:test. Verify the documented setup against @cloudflare/vitest-pool-workers 0.14.7 and confirm which types entry resolves the module. Done means the documentation accurately describes the required entry or package-version distinction.

Written by the indexing model from the issue text.

Description

product:workers stale
Example URL(s)
Actual Behavior

Following the docs, I added @cloudflare/vitest-pool-workers to compilerOptions.types and wrote a test importing from cloudflare:test.

TypeScript still reported:
Cannot find module 'cloudflare:test' or its corresponding type declarations.

In my setup, cloudflare:test only resolved after I changed the types entry from:
"types": ["@cloudflare/vitest-pool-workers"]
to:
"types": ["@cloudflare/vitest-pool-workers/types"]

Expected Behavior

Using @cloudflare/vitest-pool-workers in compilerOptions.types should make cloudflare:test resolvable, as described in the docs.

If @cloudflare/vitest-pool-workers/types is actually required for some package versions, the docs should say that explicitly.

Additional information

Environment:

  • @cloudflare/vitest-pool-workers: 0.14.7
  • vitest: 4.1.4
  • wrangler: 4.21.2
  • typescript: 5.8.3
  • vite: 6.4.2
  • @cloudflare/workers-types: 4.20260418.1

From inspecting the installed package, it looks like:

  • the root package type entry points to the main plugin/config typings
  • the ambient declare module "cloudflare:test" declaration is exposed via the ./types subpath

That appears to be why @cloudflare/vitest-pool-workers/types works while @cloudflare/vitest-pool-workers does not.

Dominant language
MDX
Stars
5.2k
Forks
16.8k
Avg merge
2d 13h
Merged PRs (30d)
344

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cloudflare/cloudflare-docs

All issues in cloudflare/cloudflare-docs

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.