Skip to content

[Workers] Correct cloudflare:test type path - #32705

Open
ting-hong-shieh wants to merge 1 commit into
cloudflare:productionfrom
ting-hong-shieh:fix/workers-vitest-test-types
Open

[Workers] Correct cloudflare:test type path#32705
ting-hong-shieh wants to merge 1 commit into
cloudflare:productionfrom
ting-hong-shieh:fix/workers-vitest-test-types

Conversation

@ting-hong-shieh

Copy link
Copy Markdown

Summary

The Workers Vitest setup text referenced the package root, which does not export the ambient cloudflare:test declarations. It now uses @cloudflare/vitest-pool-workers/types, matching the tsconfig.json example and current package exports.

Fixes #30069

Validated with pnpm run check, pnpm run format:check, pnpm run build, and pnpm run test.

Documentation checklist

  • The change adheres to the documentation style guide.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Review

✅ No issues found in commit 6ae9a14.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

No code review issues found.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

The prose tells readers to add `@cloudflare/vitest-plugin` to the tsconfig
`types` array, but that subpath resolves to the pool API declarations. The
`cloudflare:test` module is declared in the package's `./types` export, which
is what the example tsconfig immediately below already uses.
@ting-hong-shieh
ting-hong-shieh force-pushed the fix/workers-vitest-test-types branch from 0325572 to 904686a Compare August 29, 2026 14:20
@ting-hong-shieh
ting-hong-shieh requested a review from a team as a code owner August 29, 2026 14:20
@ting-hong-shieh

Copy link
Copy Markdown
Author

Rebased onto current production, and the change is now smaller than when this
was opened.

Since then the docs moved from @cloudflare/vitest-pool-workers to
@cloudflare/vitest-plugin, so the original diff no longer applied. The
underlying problem survived that rename: the prose still names the bare package,
and the bare package does not declare cloudflare:test.

From the published manifest for @cloudflare/vitest-plugin@1.1.2:

"exports": {
  ".":       { "types": "./dist/pool/index.d.mts" },
  "./types": { "types": "./types/cloudflare-test.d.ts" }
}

The root export is the pool API; cloudflare:test is declared in ./types.

The page already contradicts itself on this — the example tsconfig.json a few
lines below the sentence uses "@cloudflare/vitest-plugin/types". This makes the
prose match the example, and is now a one-line change.

@ting-hong-shieh
ting-hong-shieh force-pushed the fix/workers-vitest-test-types branch from 904686a to 6ae9a14 Compare August 29, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product size/xs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

7 participants