interface TestContextOptions
Since 0.1.0

Options for createTestContext.

Properties

optional
request: Partial<IRequest>

Partial IRequest overrides (method, url, headers, etc.).

optional
body: unknown

Body backing json()/text()/bytes() on the mock request.

optional
runtime: IRuntimeServices

Runtime services — when absent, the internal default is used.

optional
services: IServiceRegistry

Service registry — defaults to new MockServiceRegistry().

Typed as the IServiceRegistry interface (not the concrete MockServiceRegistry) so a test may pass any implementation — a custom fake, or a real kernel registry taken from a started app — matching IRequestContext.services.

optional
response: IResponse

Response builder — defaults to new MockResponse().

optional
params: Record<string, string>

Path parameters — defaults to {}.

optional
query: Record<string, string>

Query string parameters — defaults to parse from the request URL's search params.

optional
state: Map<string, unknown>

Request-scoped state — defaults to new Map().

Abort signal for ctx.signal. Precedence is options.request.signal > options.signal > a live, never-aborting AbortController().signalrequest.signal wins because that is the kernel's own rule (request.signal ?? NEVER_ABORT_CONTROLLER.signal).

optional
startTime: number

Direct startTime override — highest precedence: options.startTime ?? options.runtime?.hrtime() ?? 0. Must be a monotonic reading, never Date.now().

Usage

import { type TestContextOptions } from "testing/src/index.ts";