Testing with app.request() in Hono
From the Hono cheat sheet · Testing · verified Jul 2026
Testing with app.request()
Test your Hono app without starting a server
typescript
import { describe, it, expect } from 'vitest'
import app from './app'
describe('API Tests', () => {
it('GET / returns hello', async () => {
const res = await app.request('/')
expect(res.status).toBe(200)
expect(await res.text()).toBe('Hello Hono!')
})
it('POST /users creates user', async () => {
const res = await app.request('/users', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name: 'John' }),
})
expect(res.status).toBe(201)
const data = await res.json()
expect(data.name).toBe('John')
})
})💡 app.request() returns a real Response object
⚡ No server needed - tests run in memory
📌 Pass third argument for Cloudflare bindings/env
🎯 Works with Vitest, Jest, or any test runner