/Knowledge/sources/honojs__hono/llms-full/testing-env--00183354866d.md

Testing: Env - hono-docs

Testing: Env Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt env Summary To set c.env for testing, you...

Testing: Env

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#env

Summary

To set c.env for testing, you can pass it as the 3rd parameter to app.request. This is useful for mocking values like Cloudflare Workers Bindings: ```ts const MOCK_ENV =...

Content

To set c.env for testing, you can pass it as the 3rd parameter to app.request. This is useful for mocking values like Cloudflare Workers Bindings:

const MOCK_ENV = {
  API_HOST: 'example.com',
  DB: {
    prepare: () => {
      /* mocked D1 */
    },
  },
}

test('GET /posts', async () => {
  const res = await app.request('/posts', {}, MOCK_ENV)
})

Metadata

{
  "chunk_index": 0,
  "citation": "https://hono.dev/llms-full.txt#env",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / Testing > Env",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 99,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "Testing: Env",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/testing-env--00183354866d.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.