Skip to content

[test-harness] Port the createTestHarness() example to Build Output - #16884

Open
edmundhung wants to merge 2 commits into
edmundhung/rm-31812-test-harnessfrom
edmundhung/rm-31812-test-harness-example
Open

edmundhung wants to merge 2 commits into
edmundhung/rm-31812-test-harnessfrom
edmundhung/rm-31812-test-harness-example

Conversation

@edmundhung

@edmundhung edmundhung commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Part of DEVX-2726 (RM-31812). Stacked on #16798.

Ports fixtures/create-test-harness-example to @cloudflare/test-harness. Each Worker becomes a cf project built by the Vite plugin, and Vitest and Playwright both test that Build Output:

// Before
{
	configPath: "./workers/web/wrangler.jsonc",
	prebuiltWorkerDir: "./dist/wrangler/web",
	bindingOverrides: { BROWSER: "mock-browser" },
},

// After
{
	projectDir: "./workers/web",
	envOverrides: { BROWSER: bindings.worker({ worker: "mock-browser" }) },
},

Important

The Cloudflare docs link to this fixture as the complete createTestHarness() example, so merge this together with the docs change in DEVX-2728.


  • Tests
    • Tests included/updated
    • Automated tests not possible - manual testing has been completed as follows:
    • Additional testing not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: the docs change comes in DEVX-2728, and this merges together with it

@changeset-bot

changeset-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3320c86

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@ask-bonk

ask-bonk Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/autoconfig@16884

@cloudflare/build-output-utils

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/build-output-utils@16884

@cloudflare/codemods

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/codemods@16884

@cloudflare/config

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/config@16884

@cloudflare/containers-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/containers-shared@16884

create-cloudflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/create-cloudflare@16884

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/deploy-helpers@16884

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/kv-asset-handler@16884

miniflare

npm i https://pkg.pr.new/cloudflare/workers-sdk/miniflare@16884

@cloudflare/pages-functions

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-functions@16884

@cloudflare/pages-shared

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/pages-shared@16884

@cloudflare/runtime-types

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/runtime-types@16884

@cloudflare/test-harness

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/test-harness@16884

@cloudflare/unenv-preset

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/unenv-preset@16884

@cloudflare/vite-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vite-plugin@16884

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/cloudflare/workers-sdk/@cloudflare/vitest-plugin@16884

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

npm i https://pkg.pr.new/cloudflare/workers-sdk/wrangler@16884

commit: 3320c86

@edmundhung
edmundhung added this pull request to stack #16885 November 13, 2026 00:51
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 42a9282 to 5bcc49e Compare November 13, 2026 10:21
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 5bcc49e to 81cf8b7 Compare November 13, 2026 10:44
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 81cf8b7 to ff1a0be Compare November 17, 2026 12:20
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch 2 times, most recently from 419e5d6 to d6e9301 Compare November 17, 2026 19:16
@edmundhung
edmundhung removed this pull request from stack #16885 November 18, 2026 16:44
@edmundhung
edmundhung added this pull request to stack #17018 November 18, 2026 16:44
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch 3 times, most recently from 5059ace to 84a6086 Compare November 18, 2026 18:15
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch 2 times, most recently from ce0dea4 to 1c6a4c3 Compare November 19, 2026 11:44
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 1c6a4c3 to fbc45d5 Compare November 19, 2026 12:01
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from fbc45d5 to 3200038 Compare November 19, 2026 12:24
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch 2 times, most recently from fe8f890 to 10f8508 Compare November 19, 2026 20:45
@edmundhung edmundhung changed the title [test-harness] Add an example of testing a production build [test-harness] Port the createTestHarness() example to Build Output Nov 19, 2026
@edmundhung
edmundhung marked this pull request as ready for review November 19, 2026 20:53
@workers-devprod
workers-devprod requested review from a team and dario-piotrowicz and removed request for a team November 19, 2026 20:53
@workers-devprod

workers-devprod commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • ✅ @cloudflare/wrangler
Show detailed file reviewers

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 86ee280c.

This review, of 10f8508c

✅ Approved — No issues found. The fixture port to @​cloudflare/test-harness and cf projects built by the Vite plugin is consistent, and the tests were updated to match.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input, and no auth or access-control changes.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions. For example, the tests take expect from the test context.


📋 Code Quality: ✅ LGTM

I found no defects. The harness calls (projectDir, envOverrides with bindings.worker(...), typed getWorker<typeof import(...)> and applyD1Migrations) match the @cloudflare/test-harness API. The D1 migrations directory is still in the api project. The Turbo outputs line up with the .cloudflare/output build location, and the lockfile matches the package.json changes.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout.


Reviewed commit: 10f8508c

@dario-piotrowicz dario-piotrowicz added the ci:no-changeset-required Skip pull request checks for a valid changeset label Nov 20, 2026

@dario-piotrowicz dario-piotrowicz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🙂

@workers-devprod workers-devprod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codeowners reviews satisfied

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 4f718c27.

This review, of 86ee280c

✅ Approved — No issues found. The only change since the previously approved commit is a reworded test comment, and it now describes the code correctly.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input, and no auth changes.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions.


📋 Code Quality: ✅ LGTM

The reworded comment in tests/playwright.test.ts matches the projectDir config below it. I found no leftover references to ApiEnv, WebEnv, dist/ or the Wrangler configs.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout.


Reviewed commit: 86ee280c

@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 86ee280 to 4f718c2 Compare November 23, 2026 12:06

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 28e1aec3.

This review, of 4f718c27

✅ Approved — No issues found. The only change since the last approved commit is the reworded Playwright test comment, which now describes the projectDir config correctly.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input and no auth changes.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions.


📋 Code Quality: ✅ LGTM

I found no issues.

The only change since the last review is a reworded comment in tests/playwright.test.ts. It now says the test runs the Build Output in each project directory, which matches the projectDir config below it. This settles @​dario-piotrowicz's earlier nit.

The fixture has no leftover references to ApiEnv, WebEnv, dist/ or the removed Wrangler configs.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout.


Reviewed commit: 4f718c27

@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 4f718c2 to 28e1aec Compare November 23, 2026 14:23

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 2e3a8145.

This review, of 28e1aec3

✅ Approved — No issues found. The fixture now builds each Worker as a cf project with the Vite plugin, and nothing changed since the last approved review.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input and no auth changes.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions.


📋 Code Quality: ✅ LGTM

The fixture is ported cleanly to the cf project layout:

  • Each Worker has a cloudflare.config.ts and a vite.config.ts.
  • package.json builds each project with vite build.
  • The turbo.json outputs point at each project's .cloudflare/output.
  • The Wrangler configs and generated types are removed.
  • The lockfile entries match the package.json changes.

The test comment @​dario-piotrowicz asked about was reworded earlier and is still accurate.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout.


Reviewed commit: 28e1aec3

@edmundhung
edmundhung removed this pull request from stack #17058 November 23, 2026 17:43
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 28e1aec to 2e3a814 Compare November 23, 2026 17:44
@edmundhung
edmundhung added this pull request to stack #17134 November 23, 2026 17:45

@clanky-the-clanker clanky-the-clanker Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superseded by the review of 3320c866.

This review, of 2e3a8145

✅ Approved — No issues found. The fixture now builds each Worker as a cf project with the Vite plugin, and nothing changed since the last approved review.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input and no auth changes.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions.


📋 Code Quality: ✅ LGTM

The fixture is ported cleanly to the cf project layout:

  • Each Worker has a cloudflare.config.ts and a vite.config.ts.
  • package.json builds each project with vite build.
  • The turbo.json outputs point at each project's .cloudflare/output.
  • The Wrangler configs and generated types are removed.
  • The lockfile entries match the package.json changes.

The test comment @​dario-piotrowicz asked about was reworded earlier and is still accurate.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout.


Reviewed commit: 2e3a8145 — same changes as 28e1aec3, so this is that commit's review (no new review was run; line numbers are as of 28e1aec3)

fixtures/create-test-harness-example now tests its Workers' production build
with @cloudflare/test-harness, from Vitest and Playwright. Each Worker is a cf
project built by the Vite plugin, so the Wrangler configs, generated types and
dry-run builds are gone.

The Cloudflare docs link to this fixture as the complete example, so this
merges together with the docs change for @cloudflare/test-harness.
@edmundhung
edmundhung force-pushed the edmundhung/rm-31812-test-harness-example branch from 2e3a814 to 3320c86 Compare November 23, 2026 20:19

@clanky-the-clanker clanky-the-clanker Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved — No findings. The only change since the last approved review is a one-line README link to the fixture.

The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.


✅ All checks passed

🔒 Security: ✅ LGTM

This pull request only changes a test fixture. It adds no secrets, no handling of untrusted input and no auth changes. The KV and D1 IDs are placeholders carried over from the old Wrangler configs.


📖 AGENTS.md: ✅ LGTM

The change follows the repository conventions.


📋 Code Quality: ✅ LGTM

The only change since the last review is a link to the fixture in packages/test-harness/README.md.

The fixture has no references left from before the port: no WebEnv, ApiEnv, dist/ paths or Wrangler configs. The Worker types now come from each cloudflare.config.ts. The test comment @​dario-piotrowicz asked about was reworded earlier and is still accurate.


⚡ Performance: ✅ LGTM

No performance concerns.


📝 Documentation: ✅ LGTM

The README updates match the new project layout. The new link in packages/test-harness/README.md points to the fixture.


Reviewed commit: 3320c866

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

Labels

ci:no-changeset-required Skip pull request checks for a valid changeset

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

3 participants