Skip to main content
The Testing Helper provides utilities for testing Hono applications with full type safety and a convenient API client.

Import

Functions

testClient()

Creates a type-safe test client for making requests to your Hono application.
Hono
required
The Hono application instance to test
Bindings
Optional environment bindings (e.g., database, API keys)
ExecutionContext
Optional execution context for Cloudflare Workers
ClientRequestOptions
Additional client options (headers, etc.)
Client
A fully typed client matching your app’s routes
Example

Testing with Environment Bindings

Test applications that use environment variables:

Testing with Variables

Test applications that use context variables:

Type-Safe Request/Response

The test client provides full type safety:

Testing Different HTTP Methods

Testing Headers and Cookies

Testing with Query Parameters

Testing Nested Routes

Complete Test Example