[vitest-pool-workers] Add regression test for WorkerEntrypoint env mocking#13084
[vitest-pool-workers] Add regression test for WorkerEntrypoint env mocking#13084
Conversation
|
|
OK, the The PR description says the issue (#7077) was about const worker = new TestDefaultEntrypoint(ctx, { ...env, KV_NAMESPACE: mockKv } as Env);And Let me verify the test logic is sound:
Everything checks out. The test is clean, minimal, correctly structured, and properly tests the regression. No logic bugs, no security issues, no backward compatibility concerns. LGTM |
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: |
327c4ed to
f8b1db5
Compare
…ypoint with mocked env Closes #7077. The underlying fix landed in workerd via cloudflare/workerd#3782, which relaxed the WorkerEntrypoint constructor to accept any object as ctx rather than requiring a native ExecutionContext.
f8b1db5 to
3d614ab
Compare
Fixes #7077.
The underlying issue —
WorkerEntrypoint's native constructor rejecting a user-providedctxobject — was fixed in workerd via cloudflare/workerd#3782, which relaxed the constructor parameter fromjsg::Ref<ExecutionContext>tojsg::JsObject. This has been shipping sinceworkerd@1.20250324.0.This PR adds a regression test that constructs a
WorkerEntrypointsubclass withcreateExecutionContext()and a mockedKVNamespace, confirming the pattern works.