Skip to content

[wrangler] Support Build Output API in createTestHarness - #15997

Closed
penalosa wants to merge 1 commit into
mainfrom
cf-test-harness
Closed

penalosa wants to merge 1 commit into
mainfrom
cf-test-harness

Conversation

@penalosa

@penalosa penalosa commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Add createTestHarness({ buildOutput: true }) to run the Worker modules and assets emitted in .cloudflare/output/v0 directly in Miniflare. Requests and Worker handles use the same runtime, including scheduled events, storage, updates, and resets. Source Worker projects continue to use the existing DevEnv path.

Build Output container images are not started locally.


  • 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: This experimental programmatic API has a usage example in its exported JSDoc and a changeset describing the new mode.

Validation: 37 createTestHarness E2E tests passed; Wrangler build and type checks, changed-file lint and format checks, and git diff --check passed.

Note

This is a contribution from an AI agent: Codex (GPT-6).

@changeset-bot

changeset-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1917c7b

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

This PR includes changesets to release 3 packages
Name Type
wrangler Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-plugin 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

@pkg-pr-new

pkg-pr-new Bot commented Oct 1, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

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

@cloudflare/build-output-utils

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

@cloudflare/codemods

npm i https://pkg.pr.new/@cloudflare/codemods@15997

@cloudflare/config

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

@cloudflare/containers-shared

npm i https://pkg.pr.new/@cloudflare/containers-shared@15997

create-cloudflare

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

@cloudflare/deploy-helpers

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

@cloudflare/kv-asset-handler

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

miniflare

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

@cloudflare/pages-functions

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

@cloudflare/pages-shared

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

@cloudflare/runtime-types

npm i https://pkg.pr.new/@cloudflare/runtime-types@15997

@cloudflare/unenv-preset

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

@cloudflare/vite-plugin

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

@cloudflare/vitest-plugin

npm i https://pkg.pr.new/@cloudflare/vitest-plugin@15997

@cloudflare/workers-auth

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

@cloudflare/workers-editor-shared

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

@cloudflare/workers-utils

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

wrangler

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

commit: 1917c7b

Comment on lines +745 to +750
bindings: {
...(workerOptions.bindings as V4WorkerOptions["bindings"]),
...overrides?.vars,
...overrides?.secrets,
},
serviceBindings: {

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.

unstable_getMiniflareWorkerOptions() applies getVarsForDev(), so the bindings copied here include values from a root .dev.vars or .env file. This mode is meant to run the emitted Build Output settings, but a local MESSAGE=dev will replace the build's env.MESSAGE even without workerOverrides. Source these scalar bindings from the generated config instead, then apply the explicit test overrides.

Suggested change
bindings: {
...(workerOptions.bindings as V4WorkerOptions["bindings"]),
...overrides?.vars,
...overrides?.secrets,
},
serviceBindings: {
bindings: {
...config.vars,
...overrides?.vars,
...overrides?.secrets,
},

@ask-bonk

ask-bonk Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

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

Adds Build Output API support to createTestHarness.

  1. P1: Build Output bindings can be overridden by local .dev.vars/.env values. Posted an inline suggestion to preserve emitted config values.

github run

@NuroDev

NuroDev commented Nov 18, 2026

Copy link
Copy Markdown
Member

@penalosa is this change still needed or can this be closed?

@edmundhung

Copy link
Copy Markdown
Member

Closing in favor of #16798.

@edmundhung edmundhung closed this Nov 18, 2026
@github-project-automation github-project-automation Bot moved this from Untriaged to Done in workers-sdk Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants