hono
hono copied to clipboard
Mocking cf context don't works
What version of Hono are you using?
hono
What runtime/platform is your app running on?
Bun with Vitest for testing
What steps can reproduce the bug?
Simple repro repository
https://github.com/MatteoGauthier/hono-repro-context-cf-mock
bun test:ui
What is the expected behavior?
Using this syntax
const req = new Request(`http://localhost/context`, {
cf: {
timezone: "Europe/Paris",
},
})
const res = await app.request(req, {})
It should be possible to mock the ctx.raw.cf
What do you see instead?
undefined
Additional information
No response
Hi @MatteoGauthier
This is not a Hono-side issue, but you can refer to this implementation: https://github.com/honojs/vite-plugins/blob/main/packages/dev-server/src/adapter/cloudflare.ts#L31-L40
This issue has been marked as stale due to inactivity.
Closing this issue due to inactivity.