[wrangler] Fix vitest-pool-workers crashing when assets configured without directory#13079
[wrangler] Fix vitest-pool-workers crashing when assets configured without directory#13079
Conversation
🦋 Changeset detectedLatest commit: 9b3bc68 The changes in this PR will be included in the next version bump. 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 |
|
✅ All changesets look good |
There was a problem hiding this comment.
I'm Bonk, and I've done a quick review of your PR.
Guards getAssetsOptions() in both programmatic API callsites so that assets: { binding: "ASSETS" } without a directory no longer crashes.
Issue: The new fixture is missing a root tsconfig.json, which every other fixture in vitest-pool-workers-examples/ has. This means vitest.config.ts in this fixture won't be type-checked by tsc-all.mjs.
fixtures/vitest-pool-workers-examples/workers-assets-no-dir/vitest.config.ts
Show resolved
Hide resolved
|
Review posted successfully on PR #13079. I found one actionable issue: Missing root The core logic change in |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
9028ba4 to
f1278f5
Compare
f1278f5 to
9b3bc68
Compare
Fixes #9381.
When using
@cloudflare/vite-plugin, the wrangler config typically hasassets: { binding: "ASSETS" }without adirectory— the Vite dev server handles asset serving independently.vitest-pool-workerspasses the config path tounstable_getMiniflareWorkerOptions, which reads the raw config and callsgetAssetsOptions(). That function unconditionally requiresdirectory, so it throws "missing requireddirectoryproperty".The fix guards the
getAssetsOptions()call in both programmatic API callsites (unstable_getMiniflareWorkerOptionsandgetPlatformProxy) — when no directory is available from either the config or overrides, asset setup is skipped entirely rather than crashing.