Is your feature request related to a problem?
Tests that involve Cloudflare-specific runtime behavior currently require manually assembled mocks for bindings, execution context, and other Workers APIs.
These mocks can become complex and may diverge from the real Cloudflare Workers runtime. This makes tests harder to maintain and creates a risk that bugs are introduced by the mocks themselves rather than by the application code.
Describe the solution you'd like
I would like to see the test setup use the official Cloudflare Workers Vitest integration where possible.
In particular, tests could use @cloudflare/vitest-pool-workers with cloudflareTest, and Cloudflare-provided test APIs such as:
env from cloudflare:workers
createExecutionContext from cloudflare:test
runInDurableObject from cloudflare:test
exports.default.fetch where appropriate
This would help reduce custom mocking, make tests closer to the actual Workers runtime, and lower the chance of mock-specific bugs.
Describe alternatives you've considered
Alternative 1: Continue maintaining manual mocks for Cloudflare bindings and runtime APIs.
@opennextjs/cloudflare version
1.19.1
Additional context
https://developers.cloudflare.com/durable-objects/examples/testing-with-durable-objects/
https://developers.cloudflare.com/workers/testing/vitest-integration/write-your-first-test/
Before submitting
Is your feature request related to a problem?
Tests that involve Cloudflare-specific runtime behavior currently require manually assembled mocks for bindings, execution context, and other Workers APIs.
These mocks can become complex and may diverge from the real Cloudflare Workers runtime. This makes tests harder to maintain and creates a risk that bugs are introduced by the mocks themselves rather than by the application code.
Describe the solution you'd like
I would like to see the test setup use the official Cloudflare Workers Vitest integration where possible.
In particular, tests could use
@cloudflare/vitest-pool-workerswithcloudflareTest, and Cloudflare-provided test APIs such as:envfromcloudflare:workerscreateExecutionContextfromcloudflare:testrunInDurableObjectfromcloudflare:testexports.default.fetchwhere appropriateThis would help reduce custom mocking, make tests closer to the actual Workers runtime, and lower the chance of mock-specific bugs.
Describe alternatives you've considered
Alternative 1: Continue maintaining manual mocks for Cloudflare bindings and runtime APIs.
@opennextjs/cloudflare version
1.19.1
Additional context
https://developers.cloudflare.com/durable-objects/examples/testing-with-durable-objects/
https://developers.cloudflare.com/workers/testing/vitest-integration/write-your-first-test/
Before submitting