Skip to content

[create-cloudflare] Update Hello World templates to Vitest Pool Workers 0.20 - #14953

Open
edmundhung wants to merge 2 commits into
mainfrom
edmundhung/update-c3-vpw
Open

[create-cloudflare] Update Hello World templates to Vitest Pool Workers 0.20#14953
edmundhung wants to merge 2 commits into
mainfrom
edmundhung/update-c3-vpw

Conversation

@edmundhung

@edmundhung edmundhung commented Jul 31, 2026

Copy link
Copy Markdown
Member

Update the JavaScript and TypeScript Hello World templates, including the assets variants, to use @cloudflare/vitest-pool-workers 0.20 and Vitest 4.

Migrate their Vitest configuration to the cloudflareTest() plugin API. JavaScript configs now use .mjs because the latest Vitest Pool Workers package is ESM-only.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because: existing Create Cloudflare E2E coverage runs the test script in generated projects for all four updated template variants.
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: this updates generated development dependencies and their existing test configuration.

A picture of a cute animal (not mandatory, but encouraged)


Open in Devin Review

@changeset-bot

changeset-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9b5a980

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
create-cloudflare Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation Bot moved this to Untriaged in workers-sdk Jul 31, 2026
@workers-devprod
workers-devprod requested review from a team and penalosa and removed request for a team July 31, 2026 14:09
@workers-devprod

workers-devprod commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/fresh-hats-test.md: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/js/package.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/js/vitest.config.js: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/js/vitest.config.mjs: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/ts/package.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/ts/test/env.d.ts: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/ts/test/tsconfig.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world-with-assets/ts/vitest.config.mts: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/js/package.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/js/vitest.config.js: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/js/vitest.config.mjs: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/ts/package.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/ts/test/env.d.ts: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/ts/test/tsconfig.json: [@cloudflare/wrangler]
  • packages/create-cloudflare/templates/hello-world/ts/vitest.config.mts: [@cloudflare/wrangler]

@github-actions

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14953

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@14953

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14953

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14953

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14953

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14953

miniflare

npm i https://pkg.pr.new/miniflare@14953

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@14953

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14953

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14953

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14953

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14953

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14953

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14953

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14953

wrangler

npm i https://pkg.pr.new/wrangler@14953

commit: 9b5a980

devin-ai-integration[bot]

This comment was marked as resolved.

@ask-bonk

ask-bonk Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

I'm Bonk, and I've done a quick review of your PR.

Updates the four Hello World template variants to @cloudflare/vitest-pool-workers 0.20 / Vitest 4, migrating to the cloudflareTest() plugin API (JS configs renamed to .mjs).

The cloudflareTest() migration and version bumps look correct and match the canonical 0.20 usage in fixtures/vitest-pool-workers-examples/. One actionable issue:

1. (High) TS templates' test/tsconfig.json still point types at the package root — cloudflare:test typings will break under 0.20

Both TypeScript templates leave this unchanged:

  • packages/create-cloudflare/templates/hello-world/ts/test/tsconfig.json:4
  • packages/create-cloudflare/templates/hello-world-with-assets/ts/test/tsconfig.json:4
"types": ["@cloudflare/vitest-pool-workers"]

In 0.12.x the root "." export mapped types to ./types/cloudflare-test.d.ts (the ambient declare module "cloudflare:test"), so this worked. In 0.20.0 the root "." types now map to ./dist/pool/index.d.mts (the compiled pool/plugin API), and the ambient cloudflare:test module was moved to the dedicated ./types subpath export.

As a result, after this upgrade the test files that import { env, createExecutionContext, SELF, ... } from "cloudflare:test" will fail to type-check — the ambient module is no longer pulled in by "@cloudflare/vitest-pool-workers". The canonical 0.20 example config uses "@cloudflare/vitest-pool-workers/types" (fixtures/vitest-pool-workers-examples/tsconfig.workerd-test.json).

Suggested fix (both files):

"compilerOptions": {
    "types": ["@cloudflare/vitest-pool-workers/types"]
}

Note this won't be caught by the existing Create Cloudflare E2E coverage: verifyTestScript() (packages/create-cloudflare/e2e/helpers/workers-helpers.ts:125) only runs vitest (runtime), never tsc, so the broken type reference surfaces only in user editors / tsc, not in CI.

@ask-bonk

ask-bonk Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Posted review on PR #14953.

Summary of findings:

  • The cloudflareTest() migration and version bumps are correct and match the canonical 0.20 usage in the repo's fixtures.
  • One high-severity actionable issue: both TS templates' test/tsconfig.json still set "types": ["@cloudflare/vitest-pool-workers"], which pulled in the cloudflare:test ambient module in 0.12.x (root types = cloudflare-test.d.ts) but in 0.20 the root types map to the compiled pool API and the ambient module moved to the ./types subpath. This breaks type-checking of the test files, and the E2E only runs vitest (not tsc) so it won't be caught. I posted it as a top-level comment (rather than inline suggestions) because those tsconfig files are not part of the PR diff.

github run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

2 participants