---
title: Testing API
description: Generated public TypeScript reference for @relkit/testing.
search:
  exclude: true
sidebar:
  icon: braces
---

{/* Generated by apps/docs/scripts/generate.ts. Do not edit. */}

## Common APIs

- [invokeFunction](/docs/api/testing#invokefunction)
- [createTestApplication](/docs/api/testing#createtestapplication)

For configuration and examples, read [testing](/docs/modules/operations/testing), [first service](/docs/modules/service/first-service), [first route](/docs/modules/http/first-route).

For a complete workflow, follow [from express or hono](/guides/migrate/from-express-or-hono), [cache product prices](/guides/caching/cache-product-prices), [build an offline agent](/guides/ai/build-an-offline-agent).

## Most-used APIs

These entries carry each API's contract and example. The complete reference follows.

### invokeFunction

Invokes a function descriptor through the engine's direct, transport-free path.

**Example**

```ts
import { defineFunction } from "relkit/functions";
import { z } from "relkit/schema";
import { invokeFunction } from "@relkit/testing";

export async function greetingExample(): Promise<string> {
  const greet = defineFunction({
    id: "greet",
    input: z.string(),
    output: z.string(),
    handler: async (name) => `Hello ${name}`,
  });
  return invokeFunction(greet, "Ada");
}
```

**Signature**

```ts
declare const invokeFunction: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options?: InvokeFunctionOptions<Context>,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L52)

Since v0.1.0

### createTestApplication

Creates an application owner with HTTP, deterministic runtime and provider services.

**Example**

```ts
import { defineEnv } from "relkit/config";
import { createTestApplication } from "@relkit/testing";
async function testApplication(projectRoot: string): Promise<void> {
  const app = await createTestApplication({ env: defineEnv({}) }, { projectRoot });
  try {
    await app.http.get("/");
  } finally {
    await app.close();
  }
}
```

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L35)

Since v0.1.0

## Complete reference

## Public imports

- `@relkit/testing` — 70 exports
- `@relkit/testing/agents-conformance` — 6 exports
- `@relkit/testing/conformance` — 14 exports
- `@relkit/testing/cache-conformance` — 6 exports
- `@relkit/testing/buckets-conformance` — 6 exports
- `@relkit/testing/realtime-conformance` — 6 exports
- `@relkit/testing/events-conformance` — 8 exports
- `@relkit/testing/jobs-conformance` — 9 exports
- `@relkit/testing/runtime-conformance` — 5 exports
- `@relkit/testing/deploy-target-conformance` — 5 exports
- `@relkit/testing/drizzle` — 3 exports
- `@relkit/testing/better-auth` — 3 exports

## All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API's inline sample, a maintained repository usage, or the shared module walkthrough.

| API                                                                                            | Kind  | Import from                                                                 | Example                                                                                                                                                  |
| ---------------------------------------------------------------------------------------------- | ----- | --------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [abortedSignal](/docs/api/testing#abortedsignal)                                               | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [AGENT_CONFORMANCE_CASES](/docs/api/testing#agent_conformance_cases)                           | Value | `@relkit/testing/agents-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [AgentConformanceCase](/docs/api/testing#agentconformancecase-interface)                       | Type  | `@relkit/testing/agents-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [AgentConformanceHarness](/docs/api/testing#agentconformanceharness-interface)                 | Type  | `@relkit/testing/agents-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [AgentConformanceOptions](/docs/api/testing#agentconformanceoptions-interface)                 | Type  | `@relkit/testing/agents-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [AgentConformanceTurn](/docs/api/testing#agentconformanceturn-interface)                       | Type  | `@relkit/testing/agents-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [assertConformance](/docs/api/testing#assertconformance)                                       | Value | `@relkit/testing/conformance`                                               | [API example](/docs/api/testing#assertconformance)                                                                                                       |
| [assertObservabilityHookTypes](/docs/api/testing#assertobservabilityhooktypes)                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [assertResponseStatus](/docs/api/testing#assertresponsestatus)                                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [BUCKETS_CONFORMANCE_CASES](/docs/api/testing#buckets_conformance_cases)                       | Value | `@relkit/testing/buckets-conformance`                                       | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/types/provider-conformance.ts#L37)                                                    |
| [BucketsConformanceCase](/docs/api/testing#bucketsconformancecase-type-alias)                  | Type  | `@relkit/testing/buckets-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [BucketsConformanceCaseId](/docs/api/testing#bucketsconformancecaseid-type-alias)              | Type  | `@relkit/testing/buckets-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [BucketsConformanceOptions](/docs/api/testing#bucketsconformanceoptions-interface)             | Type  | `@relkit/testing/buckets-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [BucketsConformanceProvider](/docs/api/testing#bucketsconformanceprovider-type-alias)          | Type  | `@relkit/testing/buckets-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [CACHE_CONFORMANCE_CASES](/docs/api/testing#cache_conformance_cases)                           | Value | `@relkit/testing/cache-conformance`                                         | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [CacheConformanceCase](/docs/api/testing#cacheconformancecase-type-alias)                      | Type  | `@relkit/testing/cache-conformance`                                         | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [CacheConformanceCaseId](/docs/api/testing#cacheconformancecaseid-type-alias)                  | Type  | `@relkit/testing/cache-conformance`                                         | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/types/provider-conformance.ts#L29)                                                    |
| [CacheConformanceOptions](/docs/api/testing#cacheconformanceoptions-interface)                 | Type  | `@relkit/testing/cache-conformance`                                         | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [CacheConformanceProvider](/docs/api/testing#cacheconformanceprovider-type-alias)              | Type  | `@relkit/testing/cache-conformance`                                         | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [check](/docs/api/testing#check)                                                               | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [ConformanceCase](/docs/api/testing#conformancecase-interface)                                 | Type  | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [ConformanceCaseResult](/docs/api/testing#conformancecaseresult-interface)                     | Type  | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [conformanceHarness](/docs/api/testing#conformanceharness)                                     | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [ConformanceHarness](/docs/api/testing#conformanceharness-interface)                           | Type  | `@relkit/testing/conformance`                                               | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/types/provider-conformance.ts#L29)                                                    |
| [ConformanceReport](/docs/api/testing#conformancereport-interface)                             | Type  | `@relkit/testing/conformance`                                               | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/conformance/local-storage.test.ts#L57)                               |
| [createAgentConformanceHarness](/docs/api/testing#createagentconformanceharness)               | Value | `@relkit/testing/agents-conformance`                                        | [API example](/docs/api/testing#createagentconformanceharness)                                                                                           |
| [createBucketsConformanceHarness](/docs/api/testing#createbucketsconformanceharness)           | Value | `@relkit/testing/buckets-conformance`                                       | [API example](/docs/api/testing#createbucketsconformanceharness)                                                                                         |
| [createBunHttpListener](/docs/api/testing#createbunhttplistener)                               | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createCacheConformanceHarness](/docs/api/testing#createcacheconformanceharness)               | Value | `@relkit/testing/cache-conformance`                                         | [API example](/docs/api/testing#createcacheconformanceharness)                                                                                           |
| [createDeployTargetConformanceHarness](/docs/api/testing#createdeploytargetconformanceharness) | Value | `@relkit/testing/deploy-target-conformance`                                 | [API example](/docs/api/testing#createdeploytargetconformanceharness)                                                                                    |
| [createDeterministicJobsAdapter](/docs/api/testing#createdeterministicjobsadapter-2)           | Value | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/conformance/local-durable.test.ts#L44)                               |
| [createEventsConformanceHarness](/docs/api/testing#createeventsconformanceharness)             | Value | `@relkit/testing/events-conformance`                                        | [API example](/docs/api/testing#createeventsconformanceharness)                                                                                          |
| [createHttpTestClient](/docs/api/testing#createhttptestclient)                                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createJobsConformanceHarness](/docs/api/testing#createjobsconformanceharness-1)               | Value | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createJobsProviderConformanceHarness](/docs/api/testing#createjobsproviderconformanceharness) | Value | `@relkit/testing/jobs-conformance`                                          | [API example](/docs/api/testing#createjobsproviderconformanceharness)                                                                                    |
| [createObservabilityAssertions](/docs/api/testing#createobservabilityassertions)               | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createRealtimeConformanceHarness](/docs/api/testing#createrealtimeconformanceharness)         | Value | `@relkit/testing/realtime-conformance`                                      | [API example](/docs/api/testing#createrealtimeconformanceharness)                                                                                        |
| [createRuntimeConformanceHarness](/docs/api/testing#createruntimeconformanceharness)           | Value | `@relkit/testing/runtime-conformance`                                       | [API example](/docs/api/testing#createruntimeconformanceharness)                                                                                         |
| [createTestAgentStateProvider](/docs/api/testing#createtestagentstateprovider-1)               | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestApplication](/docs/api/testing#createtestapplication)                               | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#createtestapplication)                                                                                                   |
| [createTestApplication](/docs/api/testing#createtestapplication-2)                             | Value | `@relkit/testing/drizzle`                                                   | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/database/tests/integration/hello.route.test.ts#L6) |
| [createTestApplication](/docs/api/testing#createtestapplication-1)                             | Value | `@relkit/testing/better-auth`                                               | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/tests/tests/integration/hello.route.test.ts#L6)    |
| [createTestBucket](/docs/api/testing#createtestbucket)                                         | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestBucketFake](/docs/api/testing#createtestbucketfake)                                 | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L23)                                    |
| [createTestCache](/docs/api/testing#createtestcache)                                           | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestCacheFake](/docs/api/testing#createtestcachefake)                                   | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L25)                                    |
| [createTestEvent](/docs/api/testing#createtestevent)                                           | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/events.test.ts#L23)                                    |
| [createTestEventFake](/docs/api/testing#createtesteventfake)                                   | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestFakes](/docs/api/testing#createtestfakes)                                           | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/owned-compatibility.ts#L75)                                 |
| [createTestHttpClient](/docs/api/testing#createtesthttpclient)                                 | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L31)                                    |
| [createTestHttpListener](/docs/api/testing#createtesthttplistener)                             | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestJobsAdapter](/docs/api/testing#createtestjobsadapter-1)                             | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/commerce-layout-tasks.native.ts#L33)                             |
| [createTestObservability](/docs/api/testing#createtestobservability)                           | Value | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L121)                                                   |
| [createTestRealtimeProvider](/docs/api/testing#createtestrealtimeprovider-1)                   | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [createTestRuntime](/docs/api/testing#createtestruntime-1)                                     | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#createtestruntime-1)                                                                                                     |
| [delay](/docs/api/testing#delay)                                                               | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [DEPLOY_TARGET_CONFORMANCE_CASES](/docs/api/testing#deploy_target_conformance_cases)           | Value | `@relkit/testing/deploy-target-conformance`                                 | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [DeployTargetConformanceCase](/docs/api/testing#deploytargetconformancecase-type-alias)        | Type  | `@relkit/testing/deploy-target-conformance`                                 | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [DeployTargetConformanceCaseId](/docs/api/testing#deploytargetconformancecaseid-type-alias)    | Type  | `@relkit/testing/deploy-target-conformance`                                 | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [DeployTargetConformanceOptions](/docs/api/testing#deploytargetconformanceoptions-interface)   | Type  | `@relkit/testing/deploy-target-conformance`                                 | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EVENTS_CONFORMANCE_CASES](/docs/api/testing#events_conformance_cases)                         | Value | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceCase](/docs/api/testing#eventsconformancecase-type-alias)                    | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceCaseId](/docs/api/testing#eventsconformancecaseid-type-alias)                | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceEnvelope](/docs/api/testing#eventsconformanceenvelope-interface)             | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceOptions](/docs/api/testing#eventsconformanceoptions-interface)               | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceProvider](/docs/api/testing#eventsconformanceprovider-type-alias)            | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [EventsConformanceTrigger](/docs/api/testing#eventsconformancetrigger-interface)               | Type  | `@relkit/testing/events-conformance`                                        | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [eventually](/docs/api/testing#eventually)                                                     | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [FunctionContextOf](/docs/api/testing#functioncontextof-type-alias)                            | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [FunctionInput](/docs/api/testing#functioninput-type-alias)                                    | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [FunctionOutput](/docs/api/testing#functionoutput-type-alias)                                  | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [invokeFunction](/docs/api/testing#invokefunction)                                             | Value | `@relkit/testing`                                                           | [API example](/docs/api/testing#invokefunction)                                                                                                          |
| [InvokeFunctionOptions](/docs/api/testing#invokefunctionoptions-interface)                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JOBS_CONFORMANCE_FIXTURES](/docs/api/testing#jobs_conformance_fixtures-1)                     | Value | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsConformanceFixture](/docs/api/testing#jobsconformancefixture-interface)                   | Type  | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsConformanceHarness](/docs/api/testing#jobsconformanceharness-interface)                   | Type  | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsConformanceProvider](/docs/api/testing#jobsconformanceprovider-type-alias)                | Type  | `@relkit/testing/jobs-conformance`                                          | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [JobsProviderConformanceOptions](/docs/api/testing#jobsproviderconformanceoptions-interface)   | Type  | `@relkit/testing/jobs-conformance`                                          | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealListenerPurpose](/docs/api/testing#reallistenerpurpose-2)                                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [REALTIME_CONFORMANCE_CASES](/docs/api/testing#realtime_conformance_cases)                     | Value | `@relkit/testing/realtime-conformance`                                      | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealtimeConformanceCase](/docs/api/testing#realtimeconformancecase-type-alias)                | Type  | `@relkit/testing/realtime-conformance`                                      | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealtimeConformanceCaseId](/docs/api/testing#realtimeconformancecaseid-type-alias)            | Type  | `@relkit/testing/realtime-conformance`                                      | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealtimeConformanceOptions](/docs/api/testing#realtimeconformanceoptions-interface)           | Type  | `@relkit/testing/realtime-conformance`                                      | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RealtimeConformanceProvider](/docs/api/testing#realtimeconformanceprovider-type-alias)        | Type  | `@relkit/testing/realtime-conformance`                                      | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [rejects](/docs/api/testing#rejects)                                                           | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [responseJson](/docs/api/testing#responsejson)                                                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [responseText](/docs/api/testing#responsetext)                                                 | Value | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [runConformance](/docs/api/testing#runconformance)                                             | Value | `@relkit/testing/conformance`                                               | [API example](/docs/api/testing#runconformance)                                                                                                          |
| [runJobsConformance](/docs/api/testing#runjobsconformance-1)                                   | Value | `@relkit/testing`, `@relkit/testing/jobs-conformance`                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RUNTIME_CONFORMANCE_CASES](/docs/api/testing#runtime_conformance_cases)                       | Value | `@relkit/testing/runtime-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RuntimeConformanceCase](/docs/api/testing#runtimeconformancecase-type-alias)                  | Type  | `@relkit/testing/runtime-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RuntimeConformanceCaseId](/docs/api/testing#runtimeconformancecaseid-type-alias)              | Type  | `@relkit/testing/runtime-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [RuntimeConformanceOptions](/docs/api/testing#runtimeconformanceoptions-interface)             | Type  | `@relkit/testing/runtime-conformance`                                       | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [same](/docs/api/testing#same)                                                                 | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [SKIPPED](/docs/api/testing#skipped)                                                           | Value | `@relkit/testing/conformance`                                               | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [StandaloneFunctionTarget](/docs/api/testing#standalonefunctiontarget-interface)               | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/commerce-native-invocation.ts#L16)                                   |
| [TestApplication](/docs/api/testing#testapplication-3)                                         | Type  | `@relkit/testing`, `@relkit/testing/drizzle`, `@relkit/testing/better-auth` | [Source example](https://github.com/rel-kit/relkit/blob/main/apps/docs/examples/orders-tutorial/steps/tests/tests/integration/orders.route.test.ts#L62)  |
| [TestApplicationOptions](/docs/api/testing#testapplicationoptions-3)                           | Type  | `@relkit/testing`, `@relkit/testing/drizzle`, `@relkit/testing/better-auth` | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L90)                                    |
| [TestBucketFake](/docs/api/testing#testbucketfake-1)                                           | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/runtime-instrumentation.types.ts#L13)                            |
| [TestBucketFakeOptions](/docs/api/testing#testbucketfakeoptions-1)                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestBucketObject](/docs/api/testing#testbucketobject-1)                                       | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheFake](/docs/api/testing#testcachefake-1)                                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheFakeOptions](/docs/api/testing#testcachefakeoptions-1)                               | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestCacheSnapshot](/docs/api/testing#testcachesnapshot-1)                                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestClock](/docs/api/testing#testclock-interface)                                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventCloseOptions](/docs/api/testing#testeventcloseoptions)                               | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventDeliveryAttempt](/docs/api/testing#testeventdeliveryattempt)                         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventFake](/docs/api/testing#testeventfake)                                               | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/contracts/events.ts#L35)                                                              |
| [TestEventOptions](/docs/api/testing#testeventoptions)                                         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventPublishResult](/docs/api/testing#testeventpublishresult)                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestEventTriggerOptions](/docs/api/testing#testeventtriggeroptions)                           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestFailureControls](/docs/api/testing#testfailurecontrols-1)                                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestFakes](/docs/api/testing#testfakes-1)                                                     | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestFakesOptions](/docs/api/testing#testfakesoptions-1)                                       | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpApplication](/docs/api/testing#testhttpapplication-1)                                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpClient](/docs/api/testing#testhttpclient-1)                                           | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L51)                                                    |
| [TestHttpClientOptions](/docs/api/testing#testhttpclientoptions-1)                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpInput](/docs/api/testing#testhttpinput-1)                                             | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpListener](/docs/api/testing#testhttplistener-2)                                       | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/http/ownership.test.ts#L69)                                          |
| [TestHttpListenerOptions](/docs/api/testing#testhttplisteneroptions-2)                         | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpRequest](/docs/api/testing#testhttprequest-1)                                         | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/http/ownership.test.ts#L24)                                          |
| [TestHttpRequestInit](/docs/api/testing#testhttprequestinit-1)                                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestHttpResponse](/docs/api/testing#testhttpresponse-1)                                       | Type  | `@relkit/testing`                                                           | [API example](/docs/api/testing#testhttpresponse-1)                                                                                                      |
| [TestJobsAdapter](/docs/api/testing#testjobsadapter-interface)                                 | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/fixtures/commerce-layout-task-run.ts#L20)                                 |
| [TestJobsAdapterOptions](/docs/api/testing#testjobsadapteroptions-interface)                   | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestObservability](/docs/api/testing#testobservability-1)                                     | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/integration/http/http.test.ts#L47)                                                    |
| [TestProblemResponse](/docs/api/testing#testproblemresponse-1)                                 | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/tests/types/testing-http-client.ts#L50)                                                     |
| [TestProviderReplacements](/docs/api/testing#testproviderreplacements-type-alias)              | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestRuntime](/docs/api/testing#testruntime-interface)                                         | Type  | `@relkit/testing`                                                           | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/application-http.test.ts#L31)                          |
| [TestRuntimeCloseOptions](/docs/api/testing#testruntimecloseoptions-interface)                 | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |
| [TestRuntimeOptions](/docs/api/testing#testruntimeoptions-interface)                           | Type  | `@relkit/testing`                                                           | [Module example](/docs/modules/operations/testing)                                                                                                       |

## `agents-conformance-fixture.ts`

Builds the conformance agent, its tools, a recording engine, state, trace and access hooks.

### ConformanceRun (interface)

Everything one case observes.

**Signature**

```ts
export interface ConformanceRun {
  readonly execution: AgentAdapterExecution;
  readonly engineCalls: { readonly functionId: string; readonly input: unknown }[];
  readonly accessRequests: AgentAccessRequest[];
  readonly spans: { readonly span: string; outcome?: "ok" | "error" }[];
  readonly threads: Map<string, AgentThreadState>;
  readonly resolvedProfiles: (string | undefined)[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance-fixture.ts#L45)

### conformanceRun

Creates one agent execution with recording hooks.

**Signature**

```ts
declare const conformanceRun: (
  options: AgentConformanceOptions,
  turns: readonly AgentConformanceTurn[],
  access?: AgentAccessCheck,
) => ConformanceRun;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance-fixture.ts#L61)

### lookupTool

**Signature**

```ts
declare const lookupTool: ToolDescriptor<"conformance.lookup">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance-fixture.ts#L29)

### refundTool

**Signature**

```ts
declare const refundTool: ToolDescriptor<"conformance.refund">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance-fixture.ts#L36)

## `agents-conformance.ts`

Shared agent adapter conformance suite. Every first-party adapter runs the same cases: tools
through the engine, approvals, durable threads, AG-UI streaming, access rules, traces and model
profiles. A case rejects with a description of the first broken expectation.

### "./agents-conformance.types.js" (namespace export)

Re-exports all named exports from the "./agents-conformance.types.js" module.

**Signature**

```ts
export * from "./agents-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.ts#L15)

### AGENT_CONFORMANCE_CASES

The cases every adapter passes.

**Signature**

```ts
declare const AGENT_CONFORMANCE_CASES: ReadonlyArray<AgentConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.ts#L18)

### createAgentConformanceHarness

Creates the conformance harness for one adapter.

**Example**

```ts
import { createAgentAdapterRuntime, defineAgentRuntime } from "relkit/agent-adapters";
import { createAgentConformanceHarness } from "@relkit/testing/agents-conformance";

const harness = createAgentConformanceHarness({
  adapter: () => defineAgentRuntime({ adapterId: "echo", integrationId: "echo", options: {} }),
  runtime: createAgentAdapterRuntime({
    adapterId: "echo",
    turn: async () => ({ text: "", toolCalls: [] }),
  }),
  scriptedModel: () => ({}),
});
// In a test file: for (const item of harness.cases) test(item.description, () => harness.run(item.id));
console.log(harness.cases.map((item) => item.id));
```

**Signature**

```ts
declare const createAgentConformanceHarness: (
  options: AgentConformanceOptions,
) => AgentConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.ts#L60)

## `agents-conformance.types.ts`

Inputs and results of the shared agent adapter conformance suite.

### AgentConformanceCase (interface)

One conformance case.

**Signature**

```ts
export interface AgentConformanceCase {
  readonly id:
    "tools" | "approvals" | "threads" | "streaming" | "access-rules" | "traces" | "model-profiles";
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.types.ts#L26)

### AgentConformanceHarness (interface)

Cases plus a runner that rejects when the adapter breaks a case. It is a `ConformanceHarness`,
so `runConformance` from `@relkit/testing/conformance` reports it per case.

**Signature**

```ts
export interface AgentConformanceHarness {
  readonly suite: "agents";
  readonly cases: readonly AgentConformanceCase[];
  readonly run: (caseId: AgentConformanceCase["id"]) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.types.ts#L36)

### AgentConformanceOptions (interface)

What an adapter supplies to run the suite.

**Signature**

```ts
export interface AgentConformanceOptions {
  /** Creates the agent's `runtime` value, such as `langchain()`. */
  readonly adapter: () => AgentRuntimeAdapterAny;
  /** The adapter's runtime half, exported from its runtime entry. */
  readonly runtime: AgentAdapterRuntime;
  /** Builds the adapter's native scripted model from neutral turns. */
  readonly scriptedModel: (turns: readonly AgentConformanceTurn[]) => unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.types.ts#L16)

### AgentConformanceTurn (interface)

One scripted model turn, written once for every adapter.

**Signature**

```ts
export interface AgentConformanceTurn {
  readonly text?: string;
  readonly toolCalls?: readonly {
    readonly id: string;
    /** Model-facing tool name, such as `conformance_lookup` or `relkit_output`. */
    readonly name: string;
    readonly input: unknown;
  }[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/agents-conformance.types.ts#L5)

## `application-access.ts`

Function access rules on in-process routes, decided as the served application decides them:
the request's session is the caller, roles and permissions come from the auth service's
resolver, a rule's roles and permissions are checked before input is read, and the built-in
`unauthenticated` and `access-denied` failures answer 401 and 403 without a declaration.

### accessBeforeInput

Rejects a caller who fails a target's roles or permissions before the route reads input.

**Example**

```ts
const denied = await accessBeforeInput(route.target, principal);
```

**Signature**

```ts
declare const accessBeforeInput: (
  target: unknown,
  principal: AccessPrincipalSource | undefined,
) => Promise<Response | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-access.ts#L36)

### accessFailureResponse

Answers a built-in access failure with its status, as the served application does.

**Example**

```ts
const response = accessFailureResponse(normalizeFailure(error));
```

**Signature**

```ts
declare const accessFailureResponse: (failure: InvocationFailure) => Response | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-access.ts#L57)

### requestPrincipal

Builds the caller of one request from the application's auth runtime.

**Example**

```ts
const principal = requestPrincipal(services.auth, request);
```

**Signature**

```ts
declare const requestPrincipal: (
  auth: HttpAuthRuntime | undefined,
  request: Request,
) => AccessPrincipalSource | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-access.ts#L20)

## `application-acquisition.ts`

Acquires the general runtime and explicitly selected application services in one scope.

### acquireApplication

Native application work shares one scope and reverse-order cleanup policy.

**Signature**

```ts
declare const acquireApplication: (
  app: { readonly env: object },
  options: TestApplicationOptions,
) => Effect.Effect<ApplicationHarness, unknown, Scope | TestApplicationPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-acquisition.ts#L92)

## `application-cleanup.ts`

Finalizers preserve sibling release and report every application cleanup failure.

### cleanup

Collects release failures and retains them in the Cause when acquisition already failed.

**Signature**

```ts
declare const cleanup: (
  release: () => Promise<unknown> | undefined,
  failures: unknown[],
  failed?: boolean,
) => Effect.Effect<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-cleanup.ts#L5)

## `application-drizzle-services.ts`

Selected database-only test acquisition; authentication SDKs are never imported.

### activateDrizzleTestServices

Acquires the sole database and releases it exactly once with the returned owner.

**Signature**

```ts
declare const activateDrizzleTestServices: TestServiceActivator;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-drizzle-services.ts#L22)

## `application-errors.ts`

Normalizes foreign acquisition rejections without replacing native Error identity.

### nativeServiceError

Normalizes foreign acquisition rejections without replacing native Error identity.

**Signature**

```ts
declare const nativeServiceError: <Failure>(cause: Failure) => Error;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-errors.ts#L2)

## `application-generic-services.ts`

General application acquisition never imports a native database or authentication SDK.

### activateGenericTestServices

Rejects an unselected native helper before returning an incomplete application.

**Signature**

```ts
declare const activateGenericTestServices: TestServiceActivator;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-generic-services.ts#L7)

## `application-http.ts`

### handleTestRequest

Dispatches a matched route through existing engine validation and error mapping.

**Signature**

```ts
declare const handleTestRequest: (
  routes: readonly TestRoute[],
  runtime: TestRuntime,
  request: Request,
  getSession?: () => Promise<unknown>,
  principal?: AccessPrincipalSource,
) => Promise<Response>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-http.ts#L18)

## `application-native-services.types.ts`

Drizzle/Better Auth contracts reachable only through the selected testing helper.

### ApplicationServicesPlatform (interface)

Native dependencies substituted by test Layers without replacing ownership.

**Signature**

```ts
export interface ApplicationServicesPlatform {
  readonly load: (
    root: string,
  ) => Effect.Effect<readonly DescriptorAny[], Error | SourceLocationError>;
  readonly database: typeof activateDrizzleService;
  readonly auth: typeof activateBetterAuthService;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L13)

### AuthDeclaration (type alias)

**Signature**

```ts
type AuthDeclaration = Parameters<typeof activateBetterAuthService>[0];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L10)

### DatabaseDeclaration (type alias)

**Signature**

```ts
type DatabaseDeclaration = Parameters<typeof activateDrizzleService>[0];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L9)

### NativeAuth (type alias)

**Signature**

```ts
type NativeAuth = Awaited<ReturnType<typeof activateBetterAuthService>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L8)

### NativeDatabase (type alias)

**Signature**

```ts
type NativeDatabase = Awaited<ReturnType<typeof activateDrizzleService>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L7)

## `application-platform.ts`

Replaceable application operations and owned harness authorities.

### TestApplicationHarness (class)

Resources and release failures owned by one application Layer scope.

**Signature**

```ts
declare class TestApplicationHarness
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L16)

### TestApplicationPlatform (class)

Native application dependencies substituted before acquisition.

**Signature**

```ts
declare class TestApplicationPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L10)

### TestApplicationPlatformLive

General live platform; selected native helpers enter through explicit options.

**Signature**

```ts
declare const TestApplicationPlatformLive: Layer.Layer<TestApplicationPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-platform.ts#L22)

## `application-realtime.ts`

### bindTestRealtime

Binds registered realtime contracts to the acquired test provider generation.

**Signature**

```ts
declare const bindTestRealtime: (
  runtime: TestRuntime,
  artifacts: TestApplicationArtifacts | undefined,
  providers: ProviderRegistry | undefined,
  environment: string,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-realtime.ts#L15)

## `application-registry.ts`

Loads fresh generated modules with their original native import ancestry and guarded SDK resolution.

### TestApplicationArtifacts

Compiled graph, registry and native integration evidence acquired by an application.

**Signature**

```ts
export interface TestApplicationArtifacts {
  readonly graph: FunctionRegistryOptions["graph"];
  readonly publicFingerprint: string;
  readonly registry: FunctionRegistry;
  readonly runtimeIntegrationModules: readonly LoadedRuntimeIntegrationModule[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.types.ts#L8)

### loadTestApplicationArtifacts

Loads the generated graph, handlers, and selected integration modules for one test generation.

**Signature**

```ts
declare const loadTestApplicationArtifacts: (
  root: string,
) => Promise<TestApplicationArtifacts | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.ts#L18)

## `application-registry.types.ts`

### TestApplicationArtifacts (interface)

Compiled graph, registry and native integration evidence acquired by an application.

**Signature**

```ts
export interface TestApplicationArtifacts {
  readonly graph: FunctionRegistryOptions["graph"];
  readonly publicFingerprint: string;
  readonly registry: FunctionRegistry;
  readonly runtimeIntegrationModules: readonly LoadedRuntimeIntegrationModule[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-registry.types.ts#L8)

## `application-request.ts`

Routes application test HTTP through actual runtime invocation and selected service authorities.
Request-local auth and context patches are evaluated per request under the application's owned runtime.

### createApplicationRequest

Binds HTTP admission and request-local authentication to an acquired runtime.

**Signature**

```ts
declare const createApplicationRequest: (
  routes: readonly TestRoute[],
  applicationRuntime: TestRuntime,
  services: TestApplicationServices,
  context: Record<string, unknown>,
  overrides?: Readonly<Record<string, unknown>>,
) => TestHttpApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-request.ts#L21)

## `application-routes.ts`

### TestFunctionRoute

Native function-backed HTTP route and its declared exposure/validation contract.

**Signature**

```ts
type TestFunctionRoute = {
  readonly method: string;
  readonly path: string;
  readonly request: unknown;
  readonly target: Parameters<TestRuntime["invoke"]>[0] & {
    readonly input: StandardSchemaV1;
    readonly output: StandardSchemaV1;
    readonly errors?: readonly {
      readonly id: string;
      readonly data: StandardSchemaV1;
      readonly http?: { readonly status: number };
    }[];
  };
  readonly responses: readonly {
    readonly kind?: string;
    readonly id?: string;
    readonly status?: number;
    readonly errorId?: string;
  }[];
  /** The route's `response` option, applied to successful responses. */
  readonly response?: (output: never) => unknown;
  readonly auth?: "required";
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L5)

### TestRawRoute

Raw native HTTP route preserving its original handler and method contract.

**Signature**

```ts
type TestRawRoute = {
  readonly method: "ALL";
  readonly path: string;
  readonly handler: (request: Request) => Response | Promise<Response>;
  readonly auth?: { readonly kind: "better-auth" };
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L30)

### TestRoute

Supported native function or raw HTTP route declaration.

**Signature**

```ts
type TestRoute = TestFunctionRoute | TestRawRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L38)

### loadTestRoutes

Loads filesystem routes and derives native request/response contracts.

**Signature**

```ts
declare const loadTestRoutes: (root: string) => Promise<readonly TestRoute[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.ts#L27)

## `application-routes.types.ts`

### AuthoredRoute (type alias)

Native authored route descriptor accepted by application HTTP wiring.

**Signature**

```ts
type AuthoredRoute = Omit<TestFunctionRoute, "method" | "path" | "request" | "responses"> & {
  readonly accept?: "application/json" | "multipart/form-data";
  readonly request?: unknown;
  readonly responses?: TestFunctionRoute["responses"];
  readonly successStatus?: number;
  readonly response?: (output: never) => unknown;
  readonly auth?: "required";
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L41)

### TestFunctionRoute (type alias)

Native function-backed HTTP route and its declared exposure/validation contract.

**Signature**

```ts
type TestFunctionRoute = {
  readonly method: string;
  readonly path: string;
  readonly request: unknown;
  readonly target: Parameters<TestRuntime["invoke"]>[0] & {
    readonly input: StandardSchemaV1;
    readonly output: StandardSchemaV1;
    readonly errors?: readonly {
      readonly id: string;
      readonly data: StandardSchemaV1;
      readonly http?: { readonly status: number };
    }[];
  };
  readonly responses: readonly {
    readonly kind?: string;
    readonly id?: string;
    readonly status?: number;
    readonly errorId?: string;
  }[];
  /** The route's `response` option, applied to successful responses. */
  readonly response?: (output: never) => unknown;
  readonly auth?: "required";
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L5)

### TestRawRoute (type alias)

Raw native HTTP route preserving its original handler and method contract.

**Signature**

```ts
type TestRawRoute = {
  readonly method: "ALL";
  readonly path: string;
  readonly handler: (request: Request) => Response | Promise<Response>;
  readonly auth?: { readonly kind: "better-auth" };
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L30)

### TestRoute (type alias)

Supported native function or raw HTTP route declaration.

**Signature**

```ts
type TestRoute = TestFunctionRoute | TestRawRoute;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-routes.types.ts#L38)

## `application-server.ts`

Points a test application's HTTP client at an already running server, so an application's HTTP
suite can run against its production build on any runtime. Requests without an `Origin` get the
server's own, as a browser on the app would send. Only `http` and `close` are available; members
that need the in-process application throw when read.

### TEST_SERVER_URL_VARIABLE

Environment variable that selects a running server for `createTestApplication`.

**Signature**

```ts
declare const TEST_SERVER_URL_VARIABLE: "RELKIT_TEST_SERVER_URL";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-server.ts#L20)

### serverTestApplication

Creates a test application whose HTTP client sends requests to a running server.

**Signature**

```ts
declare const serverTestApplication: (server: string | URL) => TestApplication;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-server.ts#L27)

## `application-service-auth.ts`

Composes auth over a borrowed database without taking a second disposal authority.

### acquireApplicationAuth

Acquires the optional native auth handler and its protection runtime.

**Signature**

```ts
declare const acquireApplicationAuth: (
  platform: ApplicationServicesPlatform,
  declaration:
    | BetterAuthServiceDescriptor<
        BetterAuthServiceOptions,
        {
          session: {
            id: string;
            createdAt: Date;
            updatedAt: Date;
            userId: string;
            expiresAt: Date;
            token: string;
            ipAddress?: string | null | undefined;
            userAgent?: string | null | undefined;
          };
          user: {
            id: string;
            createdAt: Date;
            updatedAt: Date;
            email: string;
            emailVerified: boolean;
            name: string;
            image?: string | null | undefined;
          };
        },
        BetterAuthAccess<string, string>
      >
    | undefined,
  database: DrizzleActivation<DrizzleServiceDescriptor<any, any, any, any>> | undefined,
  routes: ReadonlyArray<TestRoute>,
) => Effect.Effect<
  Pick<TestApplicationServices, "auth" | "authHandler" | "authBasePath">,
  Error,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-auth.ts#L22)

### nativeServiceError

**Signature**

```ts
declare const nativeServiceError: <Failure>(cause: Failure) => Error;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-auth.ts#L69)

## `application-service-discovery.ts`

Finds native service declarations through the shared, syntax-only layout model.

### loadApplicationServices

Loads only evidenced boundaries, in deterministic order, without activating clients.

**Signature**

```ts
declare const loadApplicationServices: (
  root: string,
) => Effect.Effect<Array<DescriptorAny>, Error, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-discovery.ts#L20)

### soleNativeService

Selects the sole native declaration by its capability discriminator.

**Throws**

Error When more than one declaration owns the capability.

**Signature**

```ts
declare const soleNativeService: <Kind extends "drizzle" | "better-auth">(
  services: readonly DescriptorAny[],
  kind: Kind,
) => DescriptorAny | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-service-discovery.ts#L78)

## `application-services.ts`

Owns scoped database/auth activation for a test application in either service layout.

### ApplicationServicesPlatform

Native dependencies substituted by test Layers without replacing ownership.

**Signature**

```ts
export interface ApplicationServicesPlatform {
  readonly load: (
    root: string,
  ) => Effect.Effect<readonly DescriptorAny[], Error | SourceLocationError>;
  readonly database: typeof activateDrizzleService;
  readonly auth: typeof activateBetterAuthService;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-native-services.types.ts#L13)

### TestApplicationServices

Acquired owner-specific authorities; auth borrows the sole database.

**Signature**

```ts
export interface TestApplicationServices {
  readonly context: NonNullable<TestRuntimeOptions["context"]>;
  readonly auth?: HttpAuthRuntime;
  readonly authHandler?: (request: Request) => Promise<Response>;
  /** Where the auth handler is mounted: its route's base path, or the service's own. */
  readonly authBasePath?: string;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L10)

### TestServices (class)

Database and authentication authorities whose lifetime follows their Layer.

**Signature**

```ts
declare class TestServices
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L40)

### TestServicesPlatform (class)

Native activation dependencies acquired once per application owner.

**Signature**

```ts
declare class TestServicesPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L22)

### TestServicesPlatformLive

Live native adapters; no database or auth client is acquired by this Layer.

**Signature**

```ts
declare const TestServicesPlatformLive: Layer.Layer<TestServicesPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L91)

### activateTestServices

Acquires services with an idempotent native shutdown hook.

**Signature**

```ts
declare const activateTestServices: (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Promise<TestApplicationServices>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L118)

### testServicesLayer

Builds an owner-scoped Layer over replaceable native dependencies.

**Signature**

```ts
declare const testServicesLayer: (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Layer.Layer<TestServices, Error, TestServicesPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.ts#L103)

## `application-services.types.ts`

Native application service ownership and replaceable activation dependencies.

### ServiceEnvironment (type alias)

Uses the existing generic runtime's environment contract without an SDK dependency.

**Signature**

```ts
type ServiceEnvironment = TestRuntime["env"];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L7)

### TestApplicationServices (interface)

Acquired owner-specific authorities; auth borrows the sole database.

**Signature**

```ts
export interface TestApplicationServices {
  readonly context: NonNullable<TestRuntimeOptions["context"]>;
  readonly auth?: HttpAuthRuntime;
  readonly authHandler?: (request: Request) => Promise<Response>;
  /** Where the auth handler is mounted: its route's base path, or the service's own. */
  readonly authBasePath?: string;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L10)

### TestServiceActivator (type alias)

Explicit capability helper selected before application acquisition.

**Signature**

```ts
type TestServiceActivator = (
  root: string,
  env: ServiceEnvironment,
  routes: readonly TestRoute[],
) => Promise<TestApplicationServices>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application-services.types.ts#L20)

## `application.ts`

General test application ownership with explicitly selected capability helpers.

### TestApplication

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L26)

### TestApplicationHarness

**Signature**

```ts
declare const TestApplicationHarness: typeof TestApplicationHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L10)

### TestApplicationOptions

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  /** Directory of the application to load. Defaults to the current working directory. */
  readonly projectRoot?: string;
  /** Values for the names that provider bindings reference, such as `CACHE_URL`. */
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  /** `"fake"` gives each bucket and cache profile without a replacement a test fake. */
  readonly resourceProviders?: "configured" | "fake";
  /** Starts the application's services for the test, such as its database and auth. */
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

### TestApplicationPlatform

**Signature**

```ts
declare const TestApplicationPlatform: typeof TestApplicationPlatform;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L11)

### TestApplicationPlatformLive

**Signature**

```ts
declare const TestApplicationPlatformLive: Layer.Layer<TestApplicationPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L12)

### testApplicationLayer

Acquires the application scope using replaceable platform operations.

**Signature**

```ts
declare const testApplicationLayer: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Layer.Layer<TestApplicationHarness, unknown, TestApplicationPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.ts#L66)

## `application.types.ts`

Describes the owned test application and replaceable acquisition platform.
Generic contracts retain existing runtime environment/context semantics without a native auth or database SDK edge.

### ApplicationHarness (interface)

Effect-owned application request workflow and native application state.

**Signature**

```ts
export interface ApplicationHarness {
  readonly value: Omit<TestApplication, "close">;
  readonly cleanupFailures: unknown[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L44)

### ApplicationPlatform (interface)

Replaceable application acquisition operations used by the owning service Layer.

**Signature**

```ts
export interface ApplicationPlatform {
  readonly artifacts: typeof loadTestApplicationArtifacts;
  readonly routes: typeof loadTestRoutes;
  readonly providers: typeof activateTestProviders;
  readonly services: TestServiceActivator;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L36)

### TestApplication (interface)

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L26)

### TestApplicationOptions (type alias)

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  /** Directory of the application to load. Defaults to the current working directory. */
  readonly projectRoot?: string;
  /** Values for the names that provider bindings reference, such as `CACHE_URL`. */
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  /** `"fake"` gives each bucket and cache profile without a replacement a test fake. */
  readonly resourceProviders?: "configured" | "fake";
  /** Starts the application's services for the test, such as its database and auth. */
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

## `better-auth.ts`

Explicit database-backed authentication test application facade.

### TestApplication

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L26)

### TestApplicationOptions

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  /** Directory of the application to load. Defaults to the current working directory. */
  readonly projectRoot?: string;
  /** Values for the names that provider bindings reference, such as `CACHE_URL`. */
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  /** `"fake"` gives each bucket and cache profile without a replacement a test fake. */
  readonly resourceProviders?: "configured" | "fake";
  /** Starts the application's services for the test, such as its database and auth. */
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

### createTestApplication

Acquires auth over a borrowed database while preserving general harness ownership.

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/better-auth.ts#L8)

## `bucket-storage.schemas.ts`

### BucketStorageSnapshot

Schema authority for detached native fake bucket transfers.

**Signature**

```ts
declare const BucketStorageSnapshot: Schema.Struct<{
  readonly bucketId: Schema.String;
  readonly records: Schema.$Array<
    Schema.Struct<{
      readonly key: Schema.String;
      readonly bytes: Schema.Uint8Array;
      readonly metadata: Schema.Struct<{
        readonly etag: Schema.String;
        readonly contentHash: Schema.optionalKey<Schema.String>;
        readonly size: Schema.optionalKey<Schema.Finite>;
        readonly contentType: Schema.optionalKey<Schema.String>;
        readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
      }>;
    }>
  >;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.schemas.ts#L4)

## `bucket-storage.ts`

### TestBucketStorage (class)

Authoritative writable bucket state; every public read returns detached bytes/metadata.

**Signature**

```ts
declare class TestBucketStorage
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.ts#L22)

### bucketStorageLayer

Owns one isolated bucket, validating options before allocating its temporary root.

**Signature**

```ts
declare const bucketStorageLayer: (
  options?: TestBucketFakeOptions,
) => Layer.Layer<TestBucketStorage, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.ts#L31)

## `bucket-storage.types.ts`

### BucketStorageService (interface)

Effect decisions over authoritative writable bucket bytes and native metadata.

**Signature**

```ts
export interface BucketStorageService {
  readonly stateRoot: string;
  readonly put: (
    ...args: Parameters<NonNullable<BucketProvider["put"]>>
  ) => Effect.Effect<void, unknown>;
  readonly get: (
    ...args: Parameters<NonNullable<BucketProvider["get"]>>
  ) => Effect.Effect<Uint8Array | undefined, unknown>;
  readonly head: (
    ...args: Parameters<NonNullable<BucketProvider["head"]>>
  ) => Effect.Effect<BucketObjectMetadata | undefined, unknown>;
  readonly delete: (
    ...args: Parameters<NonNullable<BucketProvider["delete"]>>
  ) => Effect.Effect<void, unknown>;
  readonly exists: (
    ...args: Parameters<NonNullable<BucketProvider["exists"]>>
  ) => Effect.Effect<boolean, unknown>;
  readonly list: (
    ...args: Parameters<NonNullable<BucketProvider["list"]>>
  ) => Effect.Effect<readonly string[], unknown>;
  readonly inspect: Effect.Effect<readonly TestBucketObject[]>;
  readonly snapshot: Effect.Effect<BucketStorageSnapshot>;
  readonly restore: (snapshot: unknown) => Effect.Effect<void, unknown>;
  readonly clear: Effect.Effect<void>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.types.ts#L10)

### BucketStorageSnapshot (type alias)

Detached native bucket transfer derived from its decoding schema authority.

**Signature**

```ts
type BucketStorageSnapshot = typeof SnapshotSchema.Type;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-storage.types.ts#L7)

## `bucket-validation.ts`

### assertBucketKey

Rejects unsafe or empty native bucket keys.

**Signature**

```ts
declare const assertBucketKey: (value: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L10)

### assertBucketPrefix

Validates the existing optional bucket listing prefix.

**Signature**

```ts
declare const assertBucketPrefix: (value: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L30)

### copyBucketMetadata

Detaches nested native bucket metadata.

**Signature**

```ts
declare const copyBucketMetadata: (
  value: BucketObjectMetadata | undefined,
) => BucketObjectMetadata | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L42)

### copyBucketObject

Detaches stored bytes and nested native metadata.

**Signature**

```ts
declare const copyBucketObject: (value: TestBucketObject) => TestBucketObject;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/bucket-validation.ts#L57)

## `buckets-conformance-policy.ts`

Bucket policy cases of the shared bucket conformance suite: a provider created with a bucket's
limits refuses objects and signed uploads the limits do not allow, and a signed upload URL
binds the declared content type and length so the storage service rejects any other.

### CONFORMANCE_POLICY

The limits the policy cases create their provider with.

**Signature**

```ts
declare const CONFORMANCE_POLICY: Readonly<Required<BucketPolicy>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance-policy.ts#L11)

### policyCase

`put` applies the bucket's size limit and content-type allow-list.

**Signature**

```ts
declare const policyCase: (provider: BucketsConformanceProvider, prefix: string) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance-policy.ts#L43)

### signedUploadCase

A signed upload is refused before signing when its declaration breaks the policy, and the
issued URL makes the storage service reject an upload with another type or length.

**Signature**

```ts
declare const signedUploadCase: (
  provider: BucketsConformanceProvider,
  prefix: string,
  upload?: typeof globalThis.fetch,
) => Promise<void | "skipped">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance-policy.ts#L72)

## `buckets-conformance.ts`

Shared bucket provider conformance suite. Every first-party bucket provider (local, S3,
Cloudflare R2) runs these cases, and provider authors run the same ones.

### "./buckets-conformance.types.js" (namespace export)

Re-exports all named exports from the "./buckets-conformance.types.js" module.

**Signature**

```ts
export * from "./buckets-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.ts#L16)

### BUCKETS_CONFORMANCE_CASES

The cases every bucket provider passes.

**Signature**

```ts
declare const BUCKETS_CONFORMANCE_CASES: ReadonlyArray<BucketsConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.ts#L19)

### createBucketsConformanceHarness

Creates the bucket conformance harness for one provider.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createBucketsConformanceHarness } from "@relkit/testing/buckets-conformance";
import { createLocalBucketProvider } from "relkit/providers-local";

const harness = createBucketsConformanceHarness({
  create: () => createLocalBucketProvider({ root: "/tmp/relkit-bucket-conformance" }),
});
console.log((await runConformance(harness)).passed);
```

**Signature**

```ts
declare const createBucketsConformanceHarness: (
  options: BucketsConformanceOptions,
) => ConformanceHarness<BucketsConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.ts#L54)

## `buckets-conformance.types.ts`

Inputs of the shared bucket provider conformance suite.

### BucketsConformanceCase (type alias)

One bucket conformance case.

**Signature**

```ts
type BucketsConformanceCase = ConformanceCase<BucketsConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.types.ts#L53)

### BucketsConformanceCaseId (type alias)

Case ids of the bucket suite.

**Signature**

```ts
type BucketsConformanceCaseId =
  | "round-trip"
  | "metadata"
  | "overwrite"
  | "list-prefix"
  | "delete"
  | "signed-urls"
  | "cancellation"
  | "closed"
  | "backend-failure"
  | "policy"
  | "signed-upload-limits";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.types.ts#L39)

### BucketsConformanceOptions (interface)

What a bucket provider supplies to run the suite.

**Signature**

```ts
export interface BucketsConformanceOptions {
  /**
   * Creates a provider for one case. Cases write only under the key prefix they pass, so one
   * bucket can serve every case.
   * @param prefix - Unique key prefix for the case, without a trailing slash.
   */
  readonly create: (prefix: string) => BucketsConformanceProvider;
  /**
   * Failure injection: creates a provider whose backend cannot answer (an unreachable endpoint, a
   * missing binding, a failing `fetch`). The `backend-failure` case is skipped without it.
   */
  readonly failing?: () => BucketsConformanceProvider;
  /**
   * Creates a provider that applies the given bucket limits. The `policy` and
   * `signed-upload-limits` cases are skipped without it.
   * @param prefix - Unique key prefix for the case, without a trailing slash.
   * @param policy - Limits the provider must apply, as a bucket declares them.
   */
  readonly limited?: (prefix: string, policy: BucketPolicy) => BucketsConformanceProvider;
  /**
   * Sends the uploads of the `signed-upload-limits` case to a signed URL; defaults to the global
   * `fetch`.
   */
  readonly upload?: typeof globalThis.fetch;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.types.ts#L12)

### BucketsConformanceProvider (type alias)

A bucket provider under test, with the optional lifecycle methods first-party providers have.

**Signature**

```ts
type BucketsConformanceProvider = BucketProvider & {
  readonly ready?: () => Promise<unknown>;
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-conformance.types.ts#L6)

## `buckets-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./buckets.types.js" (namespace export)

Re-exports all named exports from the "./buckets.types.js" module.

**Signature**

```ts
export * from "./buckets.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets-types.ts#L2)

## `buckets.ts`

### TestBucketFake

Owned native bucket client with deterministic transfer and inspection controls.

**Signature**

```ts
export interface TestBucketFake extends BucketClient {
  readonly capabilities: { readonly signedReadUrl: false; readonly signedWriteUrl: false };
  readonly provider: BucketProvider;
  readonly client: BucketClient;
  readonly stateRoot: string;
  readonly seed: (key: string, bytes: Uint8Array, options?: BucketPutOptions) => Promise<void>;
  readonly read: (key: string) => Promise<Uint8Array | undefined>;
  readonly inspect: () => readonly TestBucketObject[];
  readonly snapshot: () => import("./bucket-storage.types.js").BucketStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L29)

### TestBucketFakeOptions

Bucket write policy and explicit clock, root and failure dependencies.

**Signature**

```ts
export interface TestBucketFakeOptions {
  readonly bucketId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly maxObjectBytes?: number;
  readonly allowedContentTypes?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L10)

### TestBucketObject

Detached native bucket bytes and metadata selected by a stable key.

**Signature**

```ts
export interface TestBucketObject {
  readonly key: string;
  readonly bytes: Uint8Array;
  readonly metadata: BucketObjectMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L22)

### createTestBucket

**Signature**

```ts
declare const createTestBucket: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L77)

### createTestBucketFake

Creates an authoritative in-memory provider behind the production Promise client.

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked resource ownership.

**Signature**

```ts
declare const createTestBucketFake: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.ts#L16)

## `buckets.types.ts`

### TestBucketFake (interface)

Owned native bucket client with deterministic transfer and inspection controls.

**Signature**

```ts
export interface TestBucketFake extends BucketClient {
  readonly capabilities: { readonly signedReadUrl: false; readonly signedWriteUrl: false };
  readonly provider: BucketProvider;
  readonly client: BucketClient;
  readonly stateRoot: string;
  readonly seed: (key: string, bytes: Uint8Array, options?: BucketPutOptions) => Promise<void>;
  readonly read: (key: string) => Promise<Uint8Array | undefined>;
  readonly inspect: () => readonly TestBucketObject[];
  readonly snapshot: () => import("./bucket-storage.types.js").BucketStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L29)

### TestBucketFakeOptions (interface)

Bucket write policy and explicit clock, root and failure dependencies.

**Signature**

```ts
export interface TestBucketFakeOptions {
  readonly bucketId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly maxObjectBytes?: number;
  readonly allowedContentTypes?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L10)

### TestBucketObject (interface)

Detached native bucket bytes and metadata selected by a stable key.

**Signature**

```ts
export interface TestBucketObject {
  readonly key: string;
  readonly bytes: Uint8Array;
  readonly metadata: BucketObjectMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L22)

## `cache-conformance.ts`

Shared cache provider conformance suite. Every first-party cache provider (local, Redis, Redis
over HTTP, Cloudflare KV) runs these cases, and provider authors run the same ones.

### "./cache-conformance.types.js" (namespace export)

Re-exports all named exports from the "./cache-conformance.types.js" module.

**Signature**

```ts
export * from "./cache-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.ts#L23)

### CACHE_CONFORMANCE_CASES

The cases every cache provider passes.

**Signature**

```ts
declare const CACHE_CONFORMANCE_CASES: ReadonlyArray<CacheConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.ts#L26)

### createCacheConformanceHarness

Creates the cache conformance harness for one provider.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createCacheConformanceHarness } from "@relkit/testing/cache-conformance";
import { createLocalCacheProvider } from "relkit/providers-local";

const harness = createCacheConformanceHarness({
  create: (cacheId) => createLocalCacheProvider({ cacheId }),
});
const report = await runConformance(harness);
console.log(report.passed);
```

**Signature**

```ts
declare const createCacheConformanceHarness: (
  options: CacheConformanceOptions,
) => ConformanceHarness<CacheConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.ts#L54)

## `cache-conformance.types.ts`

Inputs of the shared cache provider conformance suite.

### CacheConformanceCase (type alias)

One cache conformance case.

**Signature**

```ts
type CacheConformanceCase = ConformanceCase<CacheConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.types.ts#L39)

### CacheConformanceCaseId (type alias)

Case ids of the cache suite.

**Signature**

```ts
type CacheConformanceCaseId =
  | "round-trip"
  | "has-delete"
  | "get-or-set"
  | "increment"
  | "ttl"
  | "cancellation"
  | "closed"
  | "backend-failure";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.types.ts#L28)

### CacheConformanceOptions (interface)

What a cache provider supplies to run the suite.

**Signature**

```ts
export interface CacheConformanceOptions {
  /**
   * Creates a provider for one case. Each case passes a fresh cache id, so cases never share keys.
   * @param cacheId - Unique cache id for the case.
   */
  readonly create: (cacheId: string) => CacheConformanceProvider;
  /**
   * Failure injection: creates a provider whose backend cannot answer (an unreachable server, a
   * missing binding, a fault switch). The `backend-failure` case is skipped without it.
   */
  readonly failing?: () => CacheConformanceProvider;
  /** Smallest TTL the backend accepts, such as 60 000 ms on Cloudflare KV; 0 by default. */
  readonly minTtlMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.types.ts#L12)

### CacheConformanceProvider (type alias)

A cache provider under test, with the optional lifecycle methods first-party providers have.

**Signature**

```ts
type CacheConformanceProvider = CacheProvider & {
  readonly ready?: () => Promise<unknown>;
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-conformance.types.ts#L6)

## `cache-storage-state.ts`

### cacheStorageOperations

Binds native cache validation and committed mutations to one authoritative Ref.

**Signature**

```ts
declare const cacheStorageOperations: (
  state: Ref.Ref<CacheStorageState>,
  policy: CacheStoragePolicy,
) => {
  open: () => CacheStorageState;
  keyOf: (key: unknown) => string;
  active: (context: CacheOperationContext | undefined) => number;
  readEntry: (key: unknown, context: CacheOperationContext | undefined) => CacheEntry | undefined;
  writeEntry: (
    key: unknown,
    value: unknown,
    write: CacheOperationOptions | undefined,
    context: CacheOperationContext | undefined,
  ) => void;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage-state.ts#L17)

## `cache-storage.schemas.ts`

### CacheStorageKey

Restored keys retain the canonical identity produced by the native fake.

**Signature**

```ts
declare const CacheStorageKey: Schema.Struct<{
  readonly cacheId: Schema.String;
  readonly schemaVersion: Schema.Union<readonly [Schema.String, Schema.Number]>;
  readonly key: Schema.Unknown;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.schemas.ts#L4)

### CacheStorageSnapshot

Detached storage transfer; restoring requires matching cache identity/version.

**Signature**

```ts
declare const CacheStorageSnapshot: Schema.Struct<{
  readonly cacheId: Schema.String;
  readonly schemaVersion: Schema.Union<readonly [Schema.String, Schema.Number]>;
  readonly records: Schema.$Array<
    Schema.Struct<{
      readonly key: Schema.String;
      readonly value: Schema.Unknown;
      readonly expiresAt: Schema.optionalKey<Schema.Finite>;
    }>
  >;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.schemas.ts#L11)

## `cache-storage.ts`

### TestCacheStorage (class)

Authoritative writable cache state, never subject to memoization eviction.

**Signature**

```ts
declare class TestCacheStorage
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.ts#L12)

### cacheStorageLayer

Acquires one isolated fake root with scoped release and native cache semantics.

**Signature**

```ts
declare const cacheStorageLayer: (
  options: TestCacheFakeOptions,
) => Layer.Layer<TestCacheStorage, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.ts#L21)

## `cache-storage.types.ts`

### CacheEntry (interface)

Detached authoritative cache value with an optional deterministic expiration timestamp.

**Signature**

```ts
export interface CacheEntry {
  readonly value: unknown;
  readonly expiresAt?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L12)

### CacheStoragePolicy (interface)

Validated native write policy captured once before storage acquisition.

**Signature**

```ts
export interface CacheStoragePolicy {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly clock: () => number;
  readonly failures: TestFailureControls;
  readonly defaultTtlMs: number | undefined;
  readonly maxTtlMs: number | undefined;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L25)

### CacheStorageService (interface)

Effect decisions over authoritative writable cache state and transfer boundaries.

**Signature**

```ts
export interface CacheStorageService {
  readonly stateRoot: string;
  readonly get: (
    ...args: Parameters<NonNullable<CacheProvider["get"]>>
  ) => Effect.Effect<unknown, unknown>;
  readonly set: (
    ...args: Parameters<NonNullable<CacheProvider["set"]>>
  ) => Effect.Effect<void, unknown>;
  readonly delete: (
    ...args: Parameters<NonNullable<CacheProvider["delete"]>>
  ) => Effect.Effect<void, unknown>;
  readonly has: (
    ...args: Parameters<NonNullable<CacheProvider["has"]>>
  ) => Effect.Effect<boolean, unknown>;
  readonly getOrSet: (
    ...args: Parameters<NonNullable<CacheProvider["getOrSet"]>>
  ) => Effect.Effect<unknown, unknown>;
  readonly increment: (
    ...args: Parameters<NonNullable<CacheProvider["increment"]>>
  ) => Effect.Effect<number, unknown>;
  readonly inspect: Effect.Effect<TestCacheSnapshot>;
  readonly snapshot: Effect.Effect<CacheStorageSnapshot>;
  readonly restore: (snapshot: unknown) => Effect.Effect<void, unknown>;
  readonly clear: Effect.Effect<void>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L35)

### CacheStorageSnapshot (type alias)

Detached native cache transfer derived from its decoding schema authority.

**Signature**

```ts
type CacheStorageSnapshot = typeof SnapshotSchema.Type;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L9)

### CacheStorageState (interface)

Authoritative state survives until explicit owner release, without eviction.

**Signature**

```ts
export interface CacheStorageState {
  closed: boolean;
  readonly entries: Map<string, CacheEntry>;
  readonly flights: Map<string, Promise<unknown>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-storage.types.ts#L18)

## `cache-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./cache.types.js" (namespace export)

Re-exports all named exports from the "./cache.types.js" module.

**Signature**

```ts
export * from "./cache.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache-types.ts#L2)

## `cache.ts`

### TestCacheFake

Authoritative writable native cache facade with detached transfer and release controls.

**Signature**

```ts
type TestCacheFake<Key, Value> = CacheClient<Key, Value> & {
  readonly provider: CacheProvider;
  readonly client: CacheClient<Key, Value>;
  readonly capabilities: { readonly increment: true };
  readonly stateRoot: string;
  readonly seed: (key: Key, value: Value, options?: CacheOperationOptions) => Promise<void>;
  readonly read: (key: Key) => Promise<Value | undefined>;
  readonly increment: (
    key: Key,
    delta?: number,
    options?: CacheOperationOptions,
  ) => Promise<number>;
  readonly inspect: () => TestCacheSnapshot;
  readonly snapshot: () => import("./cache-storage.types.js").CacheStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L40)

### TestCacheFakeOptions

Native key/value schemas, TTL policy and explicit fake-owner dependencies.

**Signature**

```ts
export interface TestCacheFakeOptions<
  KeySchema extends StandardSchemaV1 = StandardSchemaV1,
  ValueSchema extends StandardSchemaV1 = StandardSchemaV1,
> {
  readonly cacheId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly keySchema?: KeySchema;
  readonly valueSchema?: ValueSchema;
  readonly defaultTtlMs?: number;
  readonly maxTtlMs?: number;
  readonly schemaVersion?: string | number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L10)

### TestCacheSnapshot

Native cache occupancy and identity evidence without memoization eviction.

**Signature**

```ts
export interface TestCacheSnapshot {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly entries: number;
  readonly inFlight: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L28)

### createTestCache

**Signature**

```ts
declare const createTestCache: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L98)

### createTestCacheFake

Creates authoritative cache storage behind the production Promise client.

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked schema inference.

**Signature**

```ts
declare const createTestCacheFake: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.ts#L24)

## `cache.types.ts`

### TestCacheFake (type alias)

Authoritative writable native cache facade with detached transfer and release controls.

**Signature**

```ts
type TestCacheFake<Key, Value> = CacheClient<Key, Value> & {
  readonly provider: CacheProvider;
  readonly client: CacheClient<Key, Value>;
  readonly capabilities: { readonly increment: true };
  readonly stateRoot: string;
  readonly seed: (key: Key, value: Value, options?: CacheOperationOptions) => Promise<void>;
  readonly read: (key: Key) => Promise<Value | undefined>;
  readonly increment: (
    key: Key,
    delta?: number,
    options?: CacheOperationOptions,
  ) => Promise<number>;
  readonly inspect: () => TestCacheSnapshot;
  readonly snapshot: () => import("./cache-storage.types.js").CacheStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L40)

### TestCacheFakeOptions (interface)

Native key/value schemas, TTL policy and explicit fake-owner dependencies.

**Signature**

```ts
export interface TestCacheFakeOptions<
  KeySchema extends StandardSchemaV1 = StandardSchemaV1,
  ValueSchema extends StandardSchemaV1 = StandardSchemaV1,
> {
  readonly cacheId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly keySchema?: KeySchema;
  readonly valueSchema?: ValueSchema;
  readonly defaultTtlMs?: number;
  readonly maxTtlMs?: number;
  readonly schemaVersion?: string | number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L10)

### TestCacheSnapshot (interface)

Native cache occupancy and identity evidence without memoization eviction.

**Signature**

```ts
export interface TestCacheSnapshot {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly entries: number;
  readonly inFlight: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L28)

## `conformance.ts`

Shared runner and assertions of the RelKit conformance suites. The suites use no Node or Bun
built-ins, so the same cases run on Bun, Node and inside workerd.

### "./conformance.types.js" (namespace export)

Re-exports all named exports from the "./conformance.types.js" module.

**Signature**

```ts
export * from "./conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L11)

### SKIPPED

Returned by a case that the provider does not support.

**Signature**

```ts
declare const SKIPPED: "skipped";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L14)

### abortedSignal

**Signature**

```ts
declare const abortedSignal: () => AbortSignal;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L155)

### assertConformance

Throws when a report has a failed case, naming every failure.

**Example**

```ts
import { assertConformance } from "@relkit/testing/conformance";

assertConformance({ suite: "cache", results: [], passed: true });
```

**Signature**

```ts
declare const assertConformance: (report: ConformanceReport) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L65)

### check

Fails the current case when a condition does not hold.

**Signature**

```ts
declare const check: (condition: boolean, label: string, actual?: unknown) => asserts condition;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L101)

### conformanceHarness

Builds a harness from a table of checks, one per case.

**Signature**

```ts
declare const conformanceHarness: <Id extends string>(
  suite: string,
  cases: readonly { readonly id: Id; readonly description: string }[],
  checks: Readonly<Record<Id, () => Promise<void | "skipped">>>,
) => ConformanceHarness<Id>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L79)

### delay

**Signature**

```ts
declare const delay: (ms: number) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L150)

### eventually

Polls until a condition holds or the timeout passes.

**Signature**

```ts
declare const eventually: (
  condition: () => boolean,
  step: () => Promise<unknown>,
  timeoutMs: number,
  label: string,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L135)

### rejects

Expects an operation to reject.

**Signature**

```ts
declare const rejects: (operation: () => unknown, label: string) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L120)

### runConformance

Runs every case of a harness, one after another, and reports pass, fail or skip per case.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createCacheConformanceHarness } from "@relkit/testing/cache-conformance";
import { createLocalCacheProvider } from "relkit/providers-local";

const report = await runConformance(
  createCacheConformanceHarness({ create: (cacheId) => createLocalCacheProvider({ cacheId }) }),
);
console.log(
  report.passed,
  report.results.map((result) => `${result.id}: ${result.outcome}`),
);
```

**Signature**

```ts
declare const runConformance: <Id extends string>(
  harness: ConformanceHarness<Id>,
  only?: readonly Id[],
) => Promise<ConformanceReport>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L33)

### same

Compares two JSON-compatible values structurally, ignoring object key order.

**Signature**

```ts
declare const same: (left: unknown, right: unknown) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.ts#L110)

## `conformance.types.ts`

One case of a conformance suite. Every provider of a kind runs the same cases.

### ConformanceCase (interface)

One case of a conformance suite. Every provider of a kind runs the same cases.

**Signature**

```ts
export interface ConformanceCase<Id extends string = string> {
  readonly id: Id;
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.types.ts#L4)

### ConformanceCaseResult (interface)

The outcome of one case.

**Signature**

```ts
export interface ConformanceCaseResult {
  readonly id: string;
  readonly description: string;
  readonly outcome: "pass" | "fail" | "skip";
  /** The failure message when `outcome` is `"fail"`. */
  readonly error?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.types.ts#L21)

### ConformanceHarness (interface)

Cases plus a runner. `run` resolves when the provider passes the case, resolves `"skipped"` when
the provider declares it does not support what the case checks, and rejects with a description
of the first broken expectation otherwise.

**Signature**

```ts
export interface ConformanceHarness<Id extends string = string> {
  readonly suite: string;
  readonly cases: readonly ConformanceCase<Id>[];
  readonly run: (caseId: Id) => Promise<void | "skipped">;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.types.ts#L14)

### ConformanceReport (interface)

Results of every case of one suite run against one provider.

**Signature**

```ts
export interface ConformanceReport {
  readonly suite: string;
  readonly results: readonly ConformanceCaseResult[];
  /** True when no case failed. */
  readonly passed: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/conformance.types.ts#L30)

## `deploy-target-conformance.ts`

Shared deploy-target conformance suite. The Railway, Vercel and Cloudflare targets of
`relkit deploy init` run these cases, and a new target runs the same ones.

### "./deploy-target-conformance.types.js" (namespace export)

Re-exports all named exports from the "./deploy-target-conformance.types.js" module.

**Signature**

```ts
export * from "./deploy-target-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.ts#L14)

### DEPLOY_TARGET_CONFORMANCE_CASES

The cases every deploy target passes.

**Signature**

```ts
declare const DEPLOY_TARGET_CONFORMANCE_CASES: ReadonlyArray<DeployTargetConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.ts#L17)

### createDeployTargetConformanceHarness

Creates the deploy-target conformance harness for one target.

**Example**

```ts
import { railwayDeployTarget } from "@relkit/cli/deploy-targets";
import { runConformance } from "@relkit/testing/conformance";
import { createDeployTargetConformanceHarness } from "@relkit/testing/deploy-target-conformance";

const harness = createDeployTargetConformanceHarness({
  target: railwayDeployTarget,
  root: process.cwd(),
});
console.log((await runConformance(harness)).passed);
```

**Signature**

```ts
declare const createDeployTargetConformanceHarness: (
  options: DeployTargetConformanceOptions,
) => ConformanceHarness<DeployTargetConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.ts#L45)

## `deploy-target-conformance.types.ts`

Inputs of the shared deploy-target conformance suite.

### DeployTargetConformanceCase (type alias)

One deploy-target conformance case.

**Signature**

```ts
type DeployTargetConformanceCase = ConformanceCase<DeployTargetConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.types.ts#L29)

### DeployTargetConformanceCaseId (type alias)

Case ids of the deploy-target suite.

**Signature**

```ts
type DeployTargetConformanceCaseId =
  | "naming"
  | "every-runtime"
  | "deterministic"
  | "relative-paths"
  | "ci-workflow"
  | "next-steps"
  | "graph-required";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.types.ts#L19)

### DeployTargetConformanceOptions (interface)

What a deploy target supplies to run the suite.

**Signature**

```ts
export interface DeployTargetConformanceOptions {
  /** The target under test, such as `railwayDeployTarget` from `@relkit/cli/deploy-targets`. */
  readonly target: DeployTarget;
  /** Project root passed to `plan`; it holds whatever project files the target reads. */
  readonly root: string;
  /**
   * A compiled application graph for targets that set `needsGraph`. The suite passes it as text
   * and also checks that a missing or broken graph is refused.
   */
  readonly graph?: unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/deploy-target-conformance.types.ts#L6)

## `drizzle.ts`

Selected database application harness; database ownership remains scoped to each test.

### TestApplication

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L26)

### TestApplicationOptions

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  /** Directory of the application to load. Defaults to the current working directory. */
  readonly projectRoot?: string;
  /** Values for the names that provider bindings reference, such as `CACHE_URL`. */
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  /** `"fake"` gives each bucket and cache profile without a replacement a test fake. */
  readonly resourceProviders?: "configured" | "fake";
  /** Starts the application's services for the test, such as its database and auth. */
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

### createTestApplication

Acquires the general harness with the explicit native database service installer.

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/drizzle.ts#L8)

## `event-controls.types.ts`

### EventControlsService (interface)

Effect publication, delivery, inspection and lifecycle operations over native authorities.

**Signature**

```ts
export interface EventControlsService {
  readonly publish: (
    ...args: Parameters<EventProvider["publish"]>
  ) => Effect.Effect<Awaited<ReturnType<EventProvider["publish"]>>, unknown>;
  readonly pending: (triggerId?: string) => Effect.Effect<number, unknown>;
  readonly completed: (triggerId?: string) => Effect.Effect<number, unknown>;
  readonly runNext: (triggerId?: string) => Effect.Effect<EventDeliveryResult | undefined, unknown>;
  readonly drain: Effect.Effect<readonly EventDeliveryResult[], unknown>;
  readonly restart: Effect.Effect<void, unknown>;
  readonly close: (options?: TestEventCloseOptions) => Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/event-controls.types.ts#L7)

## `events-conformance.ts`

Shared event provider conformance suite. Every first-party event provider (local, Postgres)
runs these cases, and provider authors run the same ones.

### "./events-conformance.types.js" (namespace export)

Re-exports all named exports from the "./events-conformance.types.js" module.

**Signature**

```ts
export * from "./events-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.ts#L17)

### EVENTS_CONFORMANCE_CASES

The cases every event provider passes.

**Signature**

```ts
declare const EVENTS_CONFORMANCE_CASES: ReadonlyArray<EventsConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.ts#L20)

### createEventsConformanceHarness

Creates the events conformance harness for one provider.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createEventsConformanceHarness } from "@relkit/testing/events-conformance";

const published: unknown[] = [];
const harness = createEventsConformanceHarness({
  create: () => ({
    publish: async (payload) => {
      published.push(payload);
      return { accepted: true, instanceId: `event-${published.length}` };
    },
  }),
});
console.log((await runConformance(harness, ["publish-accepted"])).passed);
```

**Signature**

```ts
declare const createEventsConformanceHarness: (
  options: EventsConformanceOptions,
) => ConformanceHarness<EventsConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.ts#L52)

## `events-conformance.types.ts`

Inputs of the shared events provider conformance suite.

### EventsConformanceCase (type alias)

One events conformance case.

**Signature**

```ts
type EventsConformanceCase = ConformanceCase<EventsConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L73)

### EventsConformanceCaseId (type alias)

Case ids of the events suite.

**Signature**

```ts
type EventsConformanceCaseId =
  | "publish-accepted"
  | "distinct-instances"
  | "delivery"
  | "retry-after-failure"
  | "backend-failure";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L65)

### EventsConformanceEnvelope (interface)

The envelope a consumer receives; every provider's trigger envelope has at least these.

**Signature**

```ts
export interface EventsConformanceEnvelope {
  readonly instanceId: string;
  readonly payload: unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L6)

### EventsConformanceOptions (interface)

What an event provider supplies to run the suite.

**Signature**

```ts
export interface EventsConformanceOptions {
  /**
   * Creates a provider for one case, already set up for `event`: a provider that validates
   * against registered contracts registers it here.
   * @param namespace - Unique profile or namespace for the case.
   * @param event - The event the cases publish.
   */
  readonly create: (
    namespace: string,
    event: { readonly id: string; readonly version: number },
  ) => EventsConformanceProvider | Promise<EventsConformanceProvider>;
  /**
   * Moves due deliveries forward, for providers that deliver on a poll the test drives (such as
   * Postgres with `consumers: false`). Background delivery needs nothing here.
   */
  readonly deliver?: (provider: EventsConformanceProvider) => Promise<unknown>;
  /**
   * The failure a consumer throws to ask for a retry. By default an `applicationFailure` with
   * `retry: "later"`; a plain `Error` is a permanent failure that is dead-lettered.
   */
  readonly retryableFailure?: () => unknown;
  /** Time limit for a delivery, 10 000 ms by default. */
  readonly deliveryTimeoutMs?: number;
  /** Failure injection: a provider whose backend cannot answer. */
  readonly failing?: () => EventsConformanceProvider | Promise<EventsConformanceProvider>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L37)

### EventsConformanceProvider (type alias)

An event provider under test. Delivery cases need `registerTrigger`.

**Signature**

```ts
type EventsConformanceProvider = EventProvider & {
  readonly registerTrigger?: (trigger: EventsConformanceTrigger) => Promise<unknown>;
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L31)

### EventsConformanceTrigger (interface)

A durable consumer, in the shape the local and Postgres event providers register through
`registerTrigger`.

**Signature**

```ts
export interface EventsConformanceTrigger {
  readonly id: string;
  readonly eventId: string;
  readonly eventVersion: number;
  readonly delivery: "durable";
  readonly retry: {
    readonly maxAttempts: number;
    readonly initialDelayMs: number;
    readonly maxDelayMs: number;
    readonly multiplier: number;
    readonly jitter: "none";
  };
  readonly invoke: (envelope: EventsConformanceEnvelope) => Promise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-conformance.types.ts#L15)

## `events-inspection.ts`

### completedEventDeliveries

Counts acknowledged durable and ephemeral deliveries.

**Signature**

```ts
declare const completedEventDeliveries: (
  state: TestEventControlState,
  triggerId?: string,
) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-inspection.ts#L38)

### pendingEventDeliveries

Counts eligible durable deliveries and persisted publications still awaiting fanout.

**Signature**

```ts
declare const pendingEventDeliveries: (state: TestEventControlState, triggerId?: string) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-inspection.ts#L10)

## `events-lifecycle.ts`

### eventLifecycle

Composes restart and final release under the event service's scoped ownership.

**Signature**

```ts
declare const eventLifecycle: (
  state: TestEventControlState,
  scope: Scope.Scope,
  context: Context.Context<never>,
) => {
  restart: Effect.Effect<void, unknown, never>;
  close: (failed?: boolean) => Effect.Effect<void, unknown, never>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-lifecycle.ts#L13)

## `events-runtime-controls.ts`

### TestEventControlState

Native authorities and Effect workflows owned by one event service Layer.

**Signature**

```ts
export interface TestEventControlState {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly router: () => EventRouter;
  readonly log: () => { readonly close: () => Promise<void> };
  readonly open: Effect.Effect<void, unknown>;
  readonly release: Effect.Effect<void, unknown>;
  readonly work: WorkOwnershipState;
  readonly openFanout: (envelope: UnknownEventEnvelope) => Effect.Effect<void, unknown>;
  readonly owner: TestStateRoot;
  readonly failures: TestFailureControls;
  readonly triggers: readonly {
    readonly id: string;
    readonly eventId: string;
    readonly eventVersion: number;
  }[];
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly unfanned: Map<string, UnknownEventEnvelope>;
  readonly remember: (result: EventDeliveryResult, envelope: UnknownEventEnvelope) => void;
  readonly publish: (
    ...args: Parameters<EventProvider["publish"]>
  ) => Effect.Effect<Awaited<ReturnType<EventProvider["publish"]>>, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L10)

### TestEventControls

Native Promise facade preserving publication, inspection and delivery signatures.

**Signature**

```ts
export interface TestEventControls {
  readonly publishNative: EventProvider["publish"];
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L34)

### TestEventExecution (class)

Delivery admission, retry/fanout and release belong to one event owner.

**Signature**

```ts
declare class TestEventExecution
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L92)

### createTestEventControls

Exposes synchronous inspection and Promise work through one owned runtime.

**Signature**

```ts
declare const createTestEventControls: (state: TestEventControlState) => Promise<TestEventControls>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L122)

### eventControlsLayer

Owns the native delivery lifecycle; alternate Layers retain this service contract.

**Signature**

```ts
declare const eventControlsLayer: (
  state: TestEventControlState,
) => Layer.Layer<TestEventExecution, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.ts#L101)

## `events-runtime-controls.types.ts`

### TestEventControlState (interface)

Native authorities and Effect workflows owned by one event service Layer.

**Signature**

```ts
export interface TestEventControlState {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly router: () => EventRouter;
  readonly log: () => { readonly close: () => Promise<void> };
  readonly open: Effect.Effect<void, unknown>;
  readonly release: Effect.Effect<void, unknown>;
  readonly work: WorkOwnershipState;
  readonly openFanout: (envelope: UnknownEventEnvelope) => Effect.Effect<void, unknown>;
  readonly owner: TestStateRoot;
  readonly failures: TestFailureControls;
  readonly triggers: readonly {
    readonly id: string;
    readonly eventId: string;
    readonly eventVersion: number;
  }[];
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly unfanned: Map<string, UnknownEventEnvelope>;
  readonly remember: (result: EventDeliveryResult, envelope: UnknownEventEnvelope) => void;
  readonly publish: (
    ...args: Parameters<EventProvider["publish"]>
  ) => Effect.Effect<Awaited<ReturnType<EventProvider["publish"]>>, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L10)

### TestEventControls (interface)

Native Promise facade preserving publication, inspection and delivery signatures.

**Signature**

```ts
export interface TestEventControls {
  readonly publishNative: EventProvider["publish"];
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-controls.types.ts#L34)

## `events-runtime-open.ts`

### OpenTestEventRuntimeOptions

Native log/router acquisition inputs and deterministic generation identity.

**Signature**

```ts
export interface OpenTestEventRuntimeOptions {
  readonly profile: string;
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly options: TestEventOptions<unknown, unknown>;
  readonly now: () => number;
  readonly random: () => number;
  readonly failures: TestFailureControls;
  readonly runner: InvocationRunner;
  readonly idSource: Parameters<typeof createEventInvoker>[4];
  readonly targets: ReadonlyMap<string, InvocationTarget<unknown, unknown>>;
  readonly generation: number;
  readonly ownerSignal?: () => AbortSignal;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.types.ts#L10)

### openTestEventRuntime

Acquires log/router resources and materializes the declared event plan.

**Signature**

```ts
declare const openTestEventRuntime: (
  input: OpenTestEventRuntimeOptions,
) => Effect.Effect<
  { log: EventLog; router: EventRouter; generation: number; storedCount: number },
  unknown,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.ts#L17)

## `events-runtime-open.types.ts`

### OpenTestEventRuntimeOptions (interface)

Native log/router acquisition inputs and deterministic generation identity.

**Signature**

```ts
export interface OpenTestEventRuntimeOptions {
  readonly profile: string;
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly options: TestEventOptions<unknown, unknown>;
  readonly now: () => number;
  readonly random: () => number;
  readonly failures: TestFailureControls;
  readonly runner: InvocationRunner;
  readonly idSource: Parameters<typeof createEventInvoker>[4];
  readonly targets: ReadonlyMap<string, InvocationTarget<unknown, unknown>>;
  readonly generation: number;
  readonly ownerSignal?: () => AbortSignal;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-open.types.ts#L10)

## `events-runtime-utils.ts`

### createEventInvoker

Binds native event invocation to deterministic dependencies and cancellation.

**Signature**

```ts
declare const createEventInvoker: (
  targets: ReadonlyMap<string, InvocationTarget<unknown, unknown>>,
  options: TestEventOptions<unknown, unknown>,
  now: () => number,
  runner: InvocationRunner,
  idSource: InvocationIdSource,
  ownerSignal?: () => AbortSignal,
) => (request: EventInvocationOptions) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L102)

### createEventTraceBridge

Binds event producer spans to deterministic native invocation identities.

**Signature**

```ts
declare const createEventTraceBridge: (
  eventId: string,
  options: Pick<TestEventOptions<unknown, unknown>, "correlationId" | "causationInvocationId">,
  clock: DeterministicClockService,
  ids: InvocationIdSource,
) => {
  run: <A>(
    operation: () => MaybePromise<A>,
    bridgeOptions?: { readonly name?: string },
  ) => Promise<A>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L40)

### fanoutEvent

Routes a persisted publication before removing its acknowledgement-gap marker.

**Signature**

```ts
declare const fanoutEvent: (
  router: EventRouter,
  envelope: UnknownEventEnvelope,
  unfanned: Map<string, UnknownEventEnvelope>,
  failures: TestFailureControls,
) => Effect.Effect<void, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L149)

### toEnvelope

Detaches an event envelope through the existing canonical JSON authority.

**Signature**

```ts
declare const toEnvelope: (value: Record<string, unknown>) => UnknownEventEnvelope;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime-utils.ts#L28)

## `events-runtime.ts`

### TestEventRuntimeOptions

Dependencies required to acquire one event log/router generation.

**Signature**

```ts
export interface TestEventRuntimeOptions<Payload, Output> {
  readonly eventId: string;
  readonly version: number;
  readonly profile: string;
  readonly triggers: readonly TestTrigger<Output>[];
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly deterministic: ReturnType<typeof createDeterministicClock>;
  readonly failures: TestFailureControls;
  readonly random: () => number;
  readonly runner: InvocationRunner;
  readonly idSource: InvocationIdSource;
  readonly options: TestEventOptions<Payload, Output>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L48)

### createTestEventRuntime

Builds the native event publication and delivery owner.

**Signature**

```ts
declare const createTestEventRuntime: <Payload, Output>(
  input: TestEventRuntimeOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.ts#L34)

## `events-runtime.types.ts`

### EventRuntimeState (interface)

All publication, fanout and admission state belongs to one event owner.

**Signature**

```ts
export interface EventRuntimeState extends WorkOwnershipState {
  readonly envelopes: UnknownEventEnvelope[];
  readonly attempts: TestEventDeliveryAttempt[];
  readonly unfanned: Map<string, UnknownEventEnvelope>;
  generation: number;
  sequence: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L35)

### OpenedEventRuntime (type alias)

Native generation acquired by the event owner's ordered Effect workflow.

**Signature**

```ts
type OpenedEventRuntime = Effect.Success<ReturnType<typeof openTestEventRuntime>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L32)

### TestEventRuntimeOptions (interface)

Dependencies required to acquire one event log/router generation.

**Signature**

```ts
export interface TestEventRuntimeOptions<Payload, Output> {
  readonly eventId: string;
  readonly version: number;
  readonly profile: string;
  readonly triggers: readonly TestTrigger<Output>[];
  readonly plan: Parameters<typeof materializeEvents>[0]["plan"];
  readonly owner: TestStateRoot;
  readonly deterministic: ReturnType<typeof createDeterministicClock>;
  readonly failures: TestFailureControls;
  readonly random: () => number;
  readonly runner: InvocationRunner;
  readonly idSource: InvocationIdSource;
  readonly options: TestEventOptions<Payload, Output>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L48)

### TestTrigger (type alias)

Normalized event trigger identity, delivery policy and native target.

**Signature**

```ts
type TestTrigger<Output> = TestEventTriggerOptions<Output> & {
  readonly delivery: "ephemeral" | "durable";
  readonly profile: string;
  readonly eventId: string;
  readonly eventVersion: number;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-runtime.types.ts#L24)

## `events-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./events.types.js" (namespace export)

Re-exports all named exports from the "./events.types.js" module.

**Signature**

```ts
export * from "./events.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events-types.ts#L2)

## `events.ts`

### createTestEvent

Creates a deterministic event publication and delivery harness.

**Signature**

```ts
declare const createTestEvent: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.ts#L18)

### createTestEventFake

**Signature**

```ts
declare const createTestEventFake: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.ts#L56)

## `events.types.ts`

### NormalizedTrigger (type alias)

Validated event trigger identity and policy used by native materialization.

**Signature**

```ts
type NormalizedTrigger<Output> = TestEventTriggerOptions<Output> & {
  readonly delivery: "ephemeral" | "durable";
  readonly profile: string;
  readonly eventId: string;
  readonly eventVersion: number;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L118)

### TestEventCloseOptions (interface)

Explicit failed-test state retention policy for event shutdown.

**Signature**

```ts
export interface TestEventCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L69)

### TestEventDeliveryAttempt (interface)

Native delivery outcome paired with its canonical persisted event envelope.

**Signature**

```ts
export interface TestEventDeliveryAttempt extends EventDeliveryResult {
  readonly envelope: UnknownEventEnvelope;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L74)

### TestEventFake (interface)

Owned native publication/delivery facade with truthful deterministic ledgers.

**Signature**

```ts
export interface TestEventFake<Payload = unknown, Output = unknown> extends EventClient<
  Payload,
  string,
  number,
  Payload
> {
  readonly id: string;
  readonly eventId: string;
  readonly version: number;
  readonly client: EventClient<Payload, string, number, Payload>;
  readonly provider: EventProvider;
  readonly stateRoot: string;
  readonly clock: TestClock;
  readonly failures: TestFailureControls;
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly attempts: readonly TestEventDeliveryAttempt[];
  readonly deliveries: readonly EventDeliveryLedgerRecord[];
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L83)

### TestEventInvocation (type alias)

Native invocation request consumed by an event target fixture.

**Signature**

```ts
type TestEventInvocation = EventInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L112)

### TestEventOptions (interface)

Event publication contract, native consumers and deterministic fixture dependencies.

**Signature**

```ts
export interface TestEventOptions<Payload = unknown, Output = unknown> {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly event?: EventDescriptorAny;
  readonly eventId?: string;
  readonly version?: number;
  readonly payloadSchema?: StandardSchemaV1;
  readonly target?: EventFunctionDescriptorAny;
  readonly triggers?: readonly TestEventTriggerOptions<Output>[];
  readonly triggerId?: string;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly ownerId?: string;
  readonly correlationId?: string;
  readonly causationInvocationId?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly stateRoot?: string;
  readonly startTimeMs?: number;
  readonly leaseDurationMs?: number;
  readonly ephemeralCapacity?: number;
  readonly random?: () => number;
  readonly randomValues?: readonly number[];
  readonly failures?: TestFailureControls;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly hooks?: InvocationHooks;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L40)

### TestEventPublishResult (type alias)

Native accepted publication receipt retained by the public event fixture.

**Signature**

```ts
type TestEventPublishResult = EventPublishResult<string, number, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L109)

### TestEventTriggerOptions (interface)

Native target and per-trigger delivery, retry and worker concurrency policy.

**Signature**

```ts
export interface TestEventTriggerOptions<Output = unknown> {
  readonly id: string;
  readonly target: EventFunctionDescriptorAny;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly timeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L25)

## `fake-utils.ts`

### TestFakeRoot

Owned native storage subdirectory and idempotent temporary-parent cleanup.

**Signature**

```ts
export interface TestFakeRoot {
  readonly stateRoot: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.types.ts#L2)

### assertFailurePoint

Validates the existing dependency-fake failure boundary name.

**Signature**

```ts
declare const assertFailurePoint: (point: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L76)

### assertName

Rejects empty dependency client names.

**Signature**

```ts
declare const assertName: (name: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L106)

### clone

Detaches native fixture data using structured cloning.

**Signature**

```ts
declare const clone: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L60)

### createFakeRoot

Acquires a category-specific persistence path beneath an owned state root.

**Signature**

```ts
declare const createFakeRoot: (
  requestedPath: string | undefined,
  category: string,
  id: string,
) => TestFakeRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L15)

### lazyRecords

Creates owner-local dependency instances only on first named access.

**Signature**

```ts
declare const lazyRecords: <T>(
  records: Record<string, T>,
  create: (id: string) => T,
) => Record<string, T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L87)

### noFailures

**Signature**

```ts
declare const noFailures: TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L64)

### positive

Validates the existing optional positive TTL policy.

**Signature**

```ts
declare const positive: (value: number | undefined, name: string) => number | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L48)

### text

Validates and trims a required fake storage identity.

**Signature**

```ts
declare const text: (value: string, name: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.ts#L37)

## `fake-utils.types.ts`

Owned native storage subdirectory and idempotent temporary-parent cleanup.

### TestFakeRoot (interface)

Owned native storage subdirectory and idempotent temporary-parent cleanup.

**Signature**

```ts
export interface TestFakeRoot {
  readonly stateRoot: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fake-utils.types.ts#L2)

## `fakes.ts`

### TestFailureControls

Owner-local native failure injection with explicit one-shot and persistent boundaries.

**Signature**

```ts
export interface TestFailureControls {
  readonly failAt: (point: string, cause?: unknown) => void;
  readonly once?: (point: string, cause?: unknown) => void;
  readonly clear: (point?: string) => void;
  readonly check: (point: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L7)

### TestFakeProviders (class)

Native dependency sources and their storage release share a single test owner.

**Signature**

```ts
declare class TestFakeProviders
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L192)

### TestFakes

Owned native dependency sources and authoritative writable storage fixtures.

**Signature**

```ts
export interface TestFakes {
  readonly stateRoot: string;
  readonly clients: DependencyClientSources;
  readonly buckets: Readonly<Record<string, TestBucketFake>>;
  readonly cache: Readonly<Record<string, TestCacheFake<unknown, unknown>>>;
  readonly providers: TestProviderReplacements;
  readonly createBucket: (
    id: string,
    options?: Omit<TestBucketFakeOptions, "bucketId" | "stateRoot" | "failures" | "clock">,
  ) => TestBucketFake;
  readonly createCache: (
    id: string,
    options?: Omit<TestCacheFakeOptions, "cacheId" | "stateRoot" | "failures" | "clock">,
  ) => TestCacheFake<unknown, unknown>;
  readonly setClient: (category: DependencyCategory, name: string, client: unknown) => void;
  readonly removeClient: (category: DependencyCategory, name: string) => void;
  readonly failures: TestFailureControls;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L22)

### TestFakesOptions

Explicit clock, logger and provider replacement policy for one fake owner.

**Signature**

```ts
export interface TestFakesOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: () => number;
  readonly providers?: TestProviderReplacements;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L15)

### createTestFakes

Creates fresh native dependency sources with an owned Effect lifetime.

**Signature**

```ts
declare const createTestFakes: (stateRoot: string, options?: TestFakesOptions) => TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L222)

### fakeProvidersLayer

Acquires synchronous fake dependencies and scopes all storage created lazily later.

**Signature**

```ts
declare const fakeProvidersLayer: (
  stateRoot: string,
  options?: TestFakesOptions,
) => Layer.Layer<TestFakeProviders, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.ts#L202)

## `fakes.types.ts`

### TestFailureControls (interface)

Owner-local native failure injection with explicit one-shot and persistent boundaries.

**Signature**

```ts
export interface TestFailureControls {
  readonly failAt: (point: string, cause?: unknown) => void;
  readonly once?: (point: string, cause?: unknown) => void;
  readonly clear: (point?: string) => void;
  readonly check: (point: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L7)

### TestFakes (interface)

Owned native dependency sources and authoritative writable storage fixtures.

**Signature**

```ts
export interface TestFakes {
  readonly stateRoot: string;
  readonly clients: DependencyClientSources;
  readonly buckets: Readonly<Record<string, TestBucketFake>>;
  readonly cache: Readonly<Record<string, TestCacheFake<unknown, unknown>>>;
  readonly providers: TestProviderReplacements;
  readonly createBucket: (
    id: string,
    options?: Omit<TestBucketFakeOptions, "bucketId" | "stateRoot" | "failures" | "clock">,
  ) => TestBucketFake;
  readonly createCache: (
    id: string,
    options?: Omit<TestCacheFakeOptions, "cacheId" | "stateRoot" | "failures" | "clock">,
  ) => TestCacheFake<unknown, unknown>;
  readonly setClient: (category: DependencyCategory, name: string, client: unknown) => void;
  readonly removeClient: (category: DependencyCategory, name: string) => void;
  readonly failures: TestFailureControls;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L22)

### TestFakesOptions (interface)

Explicit clock, logger and provider replacement policy for one fake owner.

**Signature**

```ts
export interface TestFakesOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: () => number;
  readonly providers?: TestProviderReplacements;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L15)

## `http-listener.ts`

### RealListenerPurpose

Native behavior requiring a real Bun listener in compatibility acceptance.

**Signature**

```ts
type RealListenerPurpose = "disconnect" | "stream" | "proxy";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L4)

### TestHttpListener

Owned real Bun server handle and native request/release boundary.

**Signature**

```ts
export interface TestHttpListener {
  readonly purpose: RealListenerPurpose;
  readonly url: URL;
  readonly server: Bun.Server<undefined>;
  readonly request: TestHttpRequest;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L16)

### TestHttpListenerOptions

Explicit native socket identity, timeout and disconnect test policy.

**Signature**

```ts
export interface TestHttpListenerOptions {
  readonly purpose?: RealListenerPurpose;
  readonly hostname?: string;
  readonly port?: number;
  readonly idleTimeout?: number;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L7)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L56)

### createTestHttpListener

Starts the real-socket path reserved for disconnect, streaming, and proxy tests.

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.ts#L26)

## `http-listener.types.ts`

### RealListenerPurpose (type alias)

Native behavior requiring a real Bun listener in compatibility acceptance.

**Signature**

```ts
type RealListenerPurpose = "disconnect" | "stream" | "proxy";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L4)

### TestHttpListener (interface)

Owned real Bun server handle and native request/release boundary.

**Signature**

```ts
export interface TestHttpListener {
  readonly purpose: RealListenerPurpose;
  readonly url: URL;
  readonly server: Bun.Server<undefined>;
  readonly request: TestHttpRequest;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L16)

### TestHttpListenerOptions (interface)

Explicit native socket identity, timeout and disconnect test policy.

**Signature**

```ts
export interface TestHttpListenerOptions {
  readonly purpose?: RealListenerPurpose;
  readonly hostname?: string;
  readonly port?: number;
  readonly idleTimeout?: number;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L7)

## `http-owner.ts`

### TestHttpOwner (class)

Listener admission, startup races and complete shutdown belong to one client owner.

**Signature**

```ts
declare class TestHttpOwner
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L20)

### TestHttpPlatform (class)

Native listener acquisition; tests substitute failures without opening real sockets.

**Signature**

```ts
declare class TestHttpPlatform
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L10)

### TestHttpPlatformLive

**Signature**

```ts
declare const TestHttpPlatformLive: Layer.Layer<TestHttpPlatform, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L14)

### httpOwnerLayer

Owns listener admission, late startup adoption and complete release as Effect decisions.

**Signature**

```ts
declare const httpOwnerLayer: (
  app: TestHttpApplication,
  options: TestHttpClientOptions,
) => Layer.Layer<TestHttpOwner, never, TestHttpPlatform>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.ts#L31)

## `http-owner.types.ts`

### HttpOwnerService (interface)

Effect listener admission and complete shutdown over native listener handles.

**Signature**

```ts
export interface HttpOwnerService {
  readonly listen: (options?: TestHttpListenerOptions) => Effect.Effect<TestHttpListener, unknown>;
  readonly close: Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L14)

### HttpOwnerState (interface)

Listener handles and real startup completion retained by one scoped HTTP owner.

**Signature**

```ts
export interface HttpOwnerState {
  closed: boolean;
  readonly listeners: Set<TestHttpListener>;
  readonly pending: Set<Promise<unknown>>;
  readonly startupReleaseFailures: unknown[];
  closing: Promise<void> | undefined;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L20)

### HttpPlatformService (interface)

Replaceable native listener acquisition authority for one HTTP owner.

**Signature**

```ts
export interface HttpPlatformService {
  readonly listen: typeof createTestHttpListener;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-owner.types.ts#L9)

## `http-request-init.ts`

### toRequestInit

Converts the test request options to a native `RequestInit`.

**Throws**

TypeError when `json` and `body` are both supplied.

**Signature**

```ts
declare const toRequestInit: (init: TestHttpRequestInit | undefined) => RequestInit | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-request-init.ts#L9)

## `http.ts`

### RealListenerPurpose

Native behavior requiring a real Bun listener in compatibility acceptance.

**Signature**

```ts
type RealListenerPurpose = "disconnect" | "stream" | "proxy";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L4)

### TestHttpApplication

The app request/fetch methods satisfy this boundary without leaking framework types.

**Signature**

```ts
export interface TestHttpApplication {
  readonly request?: (input: TestHttpInput, init?: RequestInit) => Response | Promise<Response>;
  readonly fetch?: (request: Request) => Response | Promise<Response>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L42)

### TestHttpClient

Owned HTTP test facade exposing direct requests and optional real listeners.

**Signature**

```ts
export interface TestHttpClient {
  readonly request: TestHttpRequest;
  readonly get: TestHttpRequest;
  readonly post: TestHttpRequest;
  readonly put: TestHttpRequest;
  readonly patch: TestHttpRequest;
  readonly delete: TestHttpRequest;
  readonly listen: (options?: TestHttpListenerOptions) => Promise<TestHttpListener>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L58)

### TestHttpClientOptions

Explicit test origin, listener close policy and ownership callbacks.

**Signature**

```ts
export interface TestHttpClientOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly baseUrl?: string | URL;
  /** Registers client shutdown with the owning test runtime/application. */
  readonly registerClose?: (close: () => Promise<void>) => void;
  readonly onClose?: () => MaybePromise<void>;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L48)

### TestHttpInput

Native Request, URL or relative path accepted by direct HTTP fixtures.

**Signature**

```ts
type TestHttpInput = Request | string | URL;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L6)

### TestHttpListener

Owned real Bun server handle and native request/release boundary.

**Signature**

```ts
export interface TestHttpListener {
  readonly purpose: RealListenerPurpose;
  readonly url: URL;
  readonly server: Bun.Server<undefined>;
  readonly request: TestHttpRequest;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L16)

### TestHttpListenerOptions

Explicit native socket identity, timeout and disconnect test policy.

**Signature**

```ts
export interface TestHttpListenerOptions {
  readonly purpose?: RealListenerPurpose;
  readonly hostname?: string;
  readonly port?: number;
  readonly idleTimeout?: number;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L7)

### TestHttpRequest

Native in-memory request operation that types the request and response JSON.

**Signature**

```ts
type TestHttpRequest = <Body = unknown, Json = unknown>(
  input: TestHttpInput,
  init?: TestHttpRequestInit<Json>,
) => Promise<TestHttpResponse<Body>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L36)

### TestHttpRequestInit

`RequestInit` with a `json` shorthand for the request body.

**Signature**

```ts
export interface TestHttpRequestInit<Json = unknown> extends RequestInit {
  /** Serialized as the body, with `content-type: application/json` unless a header already sets one. */
  readonly json?: Json;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L26)

### TestHttpResponse

Native `Response` whose JSON body has the type the test declares.

**Example**

```ts
const response = await app.http.get<{ message: string }>("/hello");
const { message } = await response.json();
```

**Signature**

```ts
export interface TestHttpResponse<Body = unknown> extends Response {
  readonly json: () => Promise<Body>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L15)

### TestObservability

Native engine event capture with ordered protocol/version assertions.

**Signature**

```ts
export interface TestObservability {
  readonly hooks: InspectableObservabilityHooks;
  readonly read: () => readonly ObservabilityHookEvent[];
  readonly types: () => readonly ObservabilityHookEvent["type"][];
  readonly assertTypes: (
    expected: readonly ObservabilityHookEvent["type"][],
  ) => readonly ObservabilityHookEvent[];
  readonly clear: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L70)

### TestProblemResponse

Problem Details response that RelKit routes return for validation and declared errors.

**Signature**

```ts
type TestProblemResponse = TestHttpResponse<ProblemDetails>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L20)

### assertObservabilityHookTypes

Asserts event order and the existing observability protocol/version.

**Signature**

```ts
declare const assertObservabilityHookTypes: (
  hooks: Pick<InspectableObservabilityHooks, "read">,
  expected: readonly ObservabilityHookEvent["type"][],
) => readonly ObservabilityHookEvent[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L174)

### assertResponseStatus

Asserts the existing native HTTP response status.

**Signature**

```ts
declare const assertResponseStatus: (response: Response, expected: number) => Response;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L117)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L104)

### createHttpTestClient

**Signature**

```ts
declare const createHttpTestClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L102)

### createObservabilityAssertions

**Signature**

```ts
declare const createObservabilityAssertions: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L166)

### createTestHttpClient

Sends ordinary route tests through the app's in-memory request entry point.

**Signature**

```ts
declare const createTestHttpClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L47)

### createTestHttpListener

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L103)

### createTestObservability

Creates a protocol/version-checked capture for engine-backed HTTP tests.

**Signature**

```ts
declare const createTestObservability: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L153)

### responseJson

Reads JSON after the optional native status assertion.

**Signature**

```ts
declare const responseJson: <T = unknown>(
  response: Response,
  expectedStatus?: number,
) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L130)

### responseText

Reads text after the optional native status assertion.

**Signature**

```ts
declare const responseText: (response: Response, expectedStatus?: number) => Promise<string>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.ts#L144)

## `http.types.ts`

### TestHttpApplication (interface)

The app request/fetch methods satisfy this boundary without leaking framework types.

**Signature**

```ts
export interface TestHttpApplication {
  readonly request?: (input: TestHttpInput, init?: RequestInit) => Response | Promise<Response>;
  readonly fetch?: (request: Request) => Response | Promise<Response>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L42)

### TestHttpClient (interface)

Owned HTTP test facade exposing direct requests and optional real listeners.

**Signature**

```ts
export interface TestHttpClient {
  readonly request: TestHttpRequest;
  readonly get: TestHttpRequest;
  readonly post: TestHttpRequest;
  readonly put: TestHttpRequest;
  readonly patch: TestHttpRequest;
  readonly delete: TestHttpRequest;
  readonly listen: (options?: TestHttpListenerOptions) => Promise<TestHttpListener>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L58)

### TestHttpClientOptions (interface)

Explicit test origin, listener close policy and ownership callbacks.

**Signature**

```ts
export interface TestHttpClientOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly baseUrl?: string | URL;
  /** Registers client shutdown with the owning test runtime/application. */
  readonly registerClose?: (close: () => Promise<void>) => void;
  readonly onClose?: () => MaybePromise<void>;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L48)

### TestHttpInput (type alias)

Native Request, URL or relative path accepted by direct HTTP fixtures.

**Signature**

```ts
type TestHttpInput = Request | string | URL;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L6)

### TestHttpRequest (type alias)

Native in-memory request operation that types the request and response JSON.

**Signature**

```ts
type TestHttpRequest = <Body = unknown, Json = unknown>(
  input: TestHttpInput,
  init?: TestHttpRequestInit<Json>,
) => Promise<TestHttpResponse<Body>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L36)

### TestHttpRequestInit (interface)

`RequestInit` with a `json` shorthand for the request body.

**Signature**

```ts
export interface TestHttpRequestInit<Json = unknown> extends RequestInit {
  /** Serialized as the body, with `content-type: application/json` unless a header already sets one. */
  readonly json?: Json;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L26)

### TestHttpResponse (interface)

Native `Response` whose JSON body has the type the test declares.

**Example**

```ts
const response = await app.http.get<{ message: string }>("/hello");
const { message } = await response.json();
```

**Signature**

```ts
export interface TestHttpResponse<Body = unknown> extends Response {
  readonly json: () => Promise<Body>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L15)

### TestObservability (interface)

Native engine event capture with ordered protocol/version assertions.

**Signature**

```ts
export interface TestObservability {
  readonly hooks: InspectableObservabilityHooks;
  readonly read: () => readonly ObservabilityHookEvent[];
  readonly types: () => readonly ObservabilityHookEvent["type"][];
  readonly assertTypes: (
    expected: readonly ObservabilityHookEvent["type"][],
  ) => readonly ObservabilityHookEvent[];
  readonly clear: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L70)

### TestProblemResponse (type alias)

Problem Details response that RelKit routes return for validation and declared errors.

**Signature**

```ts
type TestProblemResponse = TestHttpResponse<ProblemDetails>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L20)

## `identity.ts`

### TestIdentity (class)

Native trace/span/invocation identity sequence belongs to one deterministic owner.

**Signature**

```ts
declare class TestIdentity
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L7)

### createTestIdentitySource

Exposes native synchronous identity generation over the same service contract.

**Signature**

```ts
declare const createTestIdentitySource: () => InvocationIdSource;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L47)

### identityLayer

Builds the identity service once per provisioned owner.

**Signature**

```ts
declare const identityLayer: () => Layer.Layer<TestIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.ts#L39)

## `identity.types.ts`

### TestIdentityService (interface)

Deterministic identity allocation authority shared by one test owner.

**Signature**

```ts
export interface TestIdentityService {
  readonly next: (kind: Parameters<InvocationIdSource["next"]>[0]) => Effect.Effect<ProtocolId>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/identity.types.ts#L6)

## `index.ts`

Exposes generic application test owners and fakes; native helpers have feature entrypoints.

### FunctionContextOf

Context inferred from the native handler, preserving required cancellation.

**Signature**

```ts
type FunctionContextOf<Target> =
  Target extends Record<"handler", (input: infer _Input, context: infer Context) => unknown>
    ? Context extends { readonly signal: AbortSignal }
      ? Context
      : InvocationContext
    : InvocationContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L45)

### FunctionInput

Input inferred from the target's native schema authority.

**Signature**

```ts
type FunctionInput<Target extends { readonly input: StandardSchemaV1 }> = InferInput<
  Target["input"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L29)

### FunctionOutput

Output inferred from the target's native schema authority.

**Signature**

```ts
type FunctionOutput<Target extends { readonly output: StandardSchemaV1 }> = InferOutput<
  Target["output"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L37)

### InvokeFunctionOptions

Direct invocation dependencies and native hooks without process environment reads.

**Signature**

```ts
export interface InvokeFunctionOptions<Context extends { readonly signal: AbortSignal }> {
  readonly registry?: FunctionRegistry;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly signal?: AbortSignal;
  readonly now?: () => number;
  readonly idSource?: InvocationIdSource;
  readonly context?: InvocationHooks<Context>["context"];
  readonly hooks?: InvocationHooks<Context>;
  /** The caller that access rules see. Without it, the caller is read from the context's
   * `auth.getSession()` session, which has no session (an anonymous caller) unless the
   * context supplies one, and which carries no permissions. */
  readonly principal?: AccessPrincipalSource;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L56)

### JOBS_CONFORMANCE_FIXTURES

**Signature**

```ts
declare const JOBS_CONFORMANCE_FIXTURES: ReadonlyArray<JobsConformanceFixture>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L58)

### JobsConformanceFixture

Native adapter fixture inputs for reusable jobs contract assertions.

**Signature**

```ts
export interface JobsConformanceFixture {
  readonly id: string;
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L7)

### JobsConformanceHarness

Owned native jobs conformance operations and completion controls.

**Signature**

```ts
export interface JobsConformanceHarness {
  readonly adapter: TestJobsAdapter;
  readonly context: OperationContext;
  readonly fixtures: typeof JOBS_CONFORMANCE_FIXTURES;
  readonly run: (fixtureId: string) => Promise<RunHandle | undefined>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L13)

### RealListenerPurpose

Native behavior requiring a real Bun listener in compatibility acceptance.

**Signature**

```ts
type RealListenerPurpose = "disconnect" | "stream" | "proxy";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L4)

### StandaloneFunctionTarget

Native function descriptor retaining input, output and dependency validation.

**Signature**

```ts
export interface StandaloneFunctionTarget {
  readonly id: string;
  readonly input: StandardSchemaV1;
  readonly output: StandardSchemaV1;
  readonly errors?: readonly { readonly id: string; readonly data: StandardSchemaV1 }[];
  readonly dependencies?: import("relkit/engine").DependencyDeclarations;
  readonly publications?: Readonly<Record<string, import("relkit/engine").DependencyRefLike>>;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly handler: (...arguments_: readonly never[]) => MaybePromise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L13)

### TestApplication

Owned compiled test application, direct HTTP facade and complete release boundary.

**Signature**

```ts
export interface TestApplication {
  readonly runtime: TestRuntime;
  readonly http: TestHttpClient;
  readonly clock: TestClock;
  readonly fakes: TestFakes;
  readonly observability: TestObservability;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L26)

### TestApplicationOptions

Explicit test application project, environment and native platform inputs.

**Signature**

```ts
type TestApplicationOptions = Omit<TestRuntimeOptions, "app"> & {
  /** Directory of the application to load. Defaults to the current working directory. */
  readonly projectRoot?: string;
  /** Values for the names that provider bindings reference, such as `CACHE_URL`. */
  readonly bindingValues?: Readonly<Record<string, JsonValue>>;
  /** `"fake"` gives each bucket and cache profile without a replacement a test fake. */
  readonly resourceProviders?: "configured" | "fake";
  /** Starts the application's services for the test, such as its database and auth. */
  readonly services?: TestServiceActivator;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/application.types.ts#L14)

### TestBucketFake

Owned native bucket client with deterministic transfer and inspection controls.

**Signature**

```ts
export interface TestBucketFake extends BucketClient {
  readonly capabilities: { readonly signedReadUrl: false; readonly signedWriteUrl: false };
  readonly provider: BucketProvider;
  readonly client: BucketClient;
  readonly stateRoot: string;
  readonly seed: (key: string, bytes: Uint8Array, options?: BucketPutOptions) => Promise<void>;
  readonly read: (key: string) => Promise<Uint8Array | undefined>;
  readonly inspect: () => readonly TestBucketObject[];
  readonly snapshot: () => import("./bucket-storage.types.js").BucketStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L29)

### TestBucketFakeOptions

Bucket write policy and explicit clock, root and failure dependencies.

**Signature**

```ts
export interface TestBucketFakeOptions {
  readonly bucketId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly maxObjectBytes?: number;
  readonly allowedContentTypes?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L10)

### TestBucketObject

Detached native bucket bytes and metadata selected by a stable key.

**Signature**

```ts
export interface TestBucketObject {
  readonly key: string;
  readonly bytes: Uint8Array;
  readonly metadata: BucketObjectMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/buckets.types.ts#L22)

### TestCacheFake

Authoritative writable native cache facade with detached transfer and release controls.

**Signature**

```ts
type TestCacheFake<Key, Value> = CacheClient<Key, Value> & {
  readonly provider: CacheProvider;
  readonly client: CacheClient<Key, Value>;
  readonly capabilities: { readonly increment: true };
  readonly stateRoot: string;
  readonly seed: (key: Key, value: Value, options?: CacheOperationOptions) => Promise<void>;
  readonly read: (key: Key) => Promise<Value | undefined>;
  readonly increment: (
    key: Key,
    delta?: number,
    options?: CacheOperationOptions,
  ) => Promise<number>;
  readonly inspect: () => TestCacheSnapshot;
  readonly snapshot: () => import("./cache-storage.types.js").CacheStorageSnapshot;
  readonly restore: (snapshot: unknown) => void;
  readonly clear: () => void;
  readonly close: () => Promise<void>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L40)

### TestCacheFakeOptions

Native key/value schemas, TTL policy and explicit fake-owner dependencies.

**Signature**

```ts
export interface TestCacheFakeOptions<
  KeySchema extends StandardSchemaV1 = StandardSchemaV1,
  ValueSchema extends StandardSchemaV1 = StandardSchemaV1,
> {
  readonly cacheId?: string;
  readonly ownerId?: string;
  readonly stateRoot?: string;
  readonly clock?: () => number;
  readonly failures?: TestFailureControls;
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly keySchema?: KeySchema;
  readonly valueSchema?: ValueSchema;
  readonly defaultTtlMs?: number;
  readonly maxTtlMs?: number;
  readonly schemaVersion?: string | number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L10)

### TestCacheSnapshot

Native cache occupancy and identity evidence without memoization eviction.

**Signature**

```ts
export interface TestCacheSnapshot {
  readonly cacheId: string;
  readonly schemaVersion: string | number;
  readonly entries: number;
  readonly inFlight: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/cache.types.ts#L28)

### TestClock

Deterministic native time facade advanced only by explicit test commands.

**Signature**

```ts
export interface TestClock {
  readonly now: () => Date;
  readonly currentTimeMs: () => number;
  readonly advance: (milliseconds: number) => Promise<void>;
  readonly setTime: (timestamp: number) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L46)

### TestEventCloseOptions

Explicit failed-test state retention policy for event shutdown.

**Signature**

```ts
export interface TestEventCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L69)

### TestEventDeliveryAttempt

Native delivery outcome paired with its canonical persisted event envelope.

**Signature**

```ts
export interface TestEventDeliveryAttempt extends EventDeliveryResult {
  readonly envelope: UnknownEventEnvelope;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L74)

### TestEventFake

Owned native publication/delivery facade with truthful deterministic ledgers.

**Signature**

```ts
export interface TestEventFake<Payload = unknown, Output = unknown> extends EventClient<
  Payload,
  string,
  number,
  Payload
> {
  readonly id: string;
  readonly eventId: string;
  readonly version: number;
  readonly client: EventClient<Payload, string, number, Payload>;
  readonly provider: EventProvider;
  readonly stateRoot: string;
  readonly clock: TestClock;
  readonly failures: TestFailureControls;
  readonly pending: (triggerId?: string) => number;
  readonly runNext: (triggerId?: string) => Promise<EventDeliveryResult | undefined>;
  readonly drain: () => Promise<readonly EventDeliveryResult[]>;
  readonly completed: (triggerId?: string) => number;
  readonly restart: () => Promise<void>;
  readonly envelopes: readonly UnknownEventEnvelope[];
  readonly attempts: readonly TestEventDeliveryAttempt[];
  readonly deliveries: readonly EventDeliveryLedgerRecord[];
  readonly close: (options?: TestEventCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L83)

### TestEventOptions

Event publication contract, native consumers and deterministic fixture dependencies.

**Signature**

```ts
export interface TestEventOptions<Payload = unknown, Output = unknown> {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly event?: EventDescriptorAny;
  readonly eventId?: string;
  readonly version?: number;
  readonly payloadSchema?: StandardSchemaV1;
  readonly target?: EventFunctionDescriptorAny;
  readonly triggers?: readonly TestEventTriggerOptions<Output>[];
  readonly triggerId?: string;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly ownerId?: string;
  readonly correlationId?: string;
  readonly causationInvocationId?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly stateRoot?: string;
  readonly startTimeMs?: number;
  readonly leaseDurationMs?: number;
  readonly ephemeralCapacity?: number;
  readonly random?: () => number;
  readonly randomValues?: readonly number[];
  readonly failures?: TestFailureControls;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly hooks?: InvocationHooks;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L40)

### TestEventPublishResult

Native accepted publication receipt retained by the public event fixture.

**Signature**

```ts
type TestEventPublishResult = EventPublishResult<string, number, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L109)

### TestEventTriggerOptions

Native target and per-trigger delivery, retry and worker concurrency policy.

**Signature**

```ts
export interface TestEventTriggerOptions<Output = unknown> {
  readonly id: string;
  readonly target: EventFunctionDescriptorAny;
  readonly delivery?: "ephemeral" | "durable";
  readonly profile?: string;
  readonly retry?: RetryPolicy;
  readonly concurrency?: number;
  readonly timeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/events.types.ts#L25)

### TestFailureControls

Owner-local native failure injection with explicit one-shot and persistent boundaries.

**Signature**

```ts
export interface TestFailureControls {
  readonly failAt: (point: string, cause?: unknown) => void;
  readonly once?: (point: string, cause?: unknown) => void;
  readonly clear: (point?: string) => void;
  readonly check: (point: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L7)

### TestFakes

Owned native dependency sources and authoritative writable storage fixtures.

**Signature**

```ts
export interface TestFakes {
  readonly stateRoot: string;
  readonly clients: DependencyClientSources;
  readonly buckets: Readonly<Record<string, TestBucketFake>>;
  readonly cache: Readonly<Record<string, TestCacheFake<unknown, unknown>>>;
  readonly providers: TestProviderReplacements;
  readonly createBucket: (
    id: string,
    options?: Omit<TestBucketFakeOptions, "bucketId" | "stateRoot" | "failures" | "clock">,
  ) => TestBucketFake;
  readonly createCache: (
    id: string,
    options?: Omit<TestCacheFakeOptions, "cacheId" | "stateRoot" | "failures" | "clock">,
  ) => TestCacheFake<unknown, unknown>;
  readonly setClient: (category: DependencyCategory, name: string, client: unknown) => void;
  readonly removeClient: (category: DependencyCategory, name: string) => void;
  readonly failures: TestFailureControls;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L22)

### TestFakesOptions

Explicit clock, logger and provider replacement policy for one fake owner.

**Signature**

```ts
export interface TestFakesOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: () => number;
  readonly providers?: TestProviderReplacements;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/fakes.types.ts#L15)

### TestHttpApplication

The app request/fetch methods satisfy this boundary without leaking framework types.

**Signature**

```ts
export interface TestHttpApplication {
  readonly request?: (input: TestHttpInput, init?: RequestInit) => Response | Promise<Response>;
  readonly fetch?: (request: Request) => Response | Promise<Response>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L42)

### TestHttpClient

Owned HTTP test facade exposing direct requests and optional real listeners.

**Signature**

```ts
export interface TestHttpClient {
  readonly request: TestHttpRequest;
  readonly get: TestHttpRequest;
  readonly post: TestHttpRequest;
  readonly put: TestHttpRequest;
  readonly patch: TestHttpRequest;
  readonly delete: TestHttpRequest;
  readonly listen: (options?: TestHttpListenerOptions) => Promise<TestHttpListener>;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L58)

### TestHttpClientOptions

Explicit test origin, listener close policy and ownership callbacks.

**Signature**

```ts
export interface TestHttpClientOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly baseUrl?: string | URL;
  /** Registers client shutdown with the owning test runtime/application. */
  readonly registerClose?: (close: () => Promise<void>) => void;
  readonly onClose?: () => MaybePromise<void>;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L48)

### TestHttpInput

Native Request, URL or relative path accepted by direct HTTP fixtures.

**Signature**

```ts
type TestHttpInput = Request | string | URL;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L6)

### TestHttpListener

Owned real Bun server handle and native request/release boundary.

**Signature**

```ts
export interface TestHttpListener {
  readonly purpose: RealListenerPurpose;
  readonly url: URL;
  readonly server: Bun.Server<undefined>;
  readonly request: TestHttpRequest;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L16)

### TestHttpListenerOptions

Explicit native socket identity, timeout and disconnect test policy.

**Signature**

```ts
export interface TestHttpListenerOptions {
  readonly purpose?: RealListenerPurpose;
  readonly hostname?: string;
  readonly port?: number;
  readonly idleTimeout?: number;
  readonly closeTimeoutMs?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http-listener.types.ts#L7)

### TestHttpRequest

Native in-memory request operation that types the request and response JSON.

**Signature**

```ts
type TestHttpRequest = <Body = unknown, Json = unknown>(
  input: TestHttpInput,
  init?: TestHttpRequestInit<Json>,
) => Promise<TestHttpResponse<Body>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L36)

### TestHttpRequestInit

`RequestInit` with a `json` shorthand for the request body.

**Signature**

```ts
export interface TestHttpRequestInit<Json = unknown> extends RequestInit {
  /** Serialized as the body, with `content-type: application/json` unless a header already sets one. */
  readonly json?: Json;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L26)

### TestHttpResponse

Native `Response` whose JSON body has the type the test declares.

**Example**

```ts
const response = await app.http.get<{ message: string }>("/hello");
const { message } = await response.json();
```

**Signature**

```ts
export interface TestHttpResponse<Body = unknown> extends Response {
  readonly json: () => Promise<Body>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L15)

### TestJobsAdapter

Owned native jobs adapter with deterministic worker and snapshot test controls.

**Signature**

```ts
export interface TestJobsAdapter extends JobsAdapterRuntime {
  readonly clock: TestClock;
  readonly runNext: () => Promise<import("relkit/jobs/adapter").NativeTaskWork | undefined>;
  readonly snapshot: (runId: string) => RunSnapshot;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L15)

### TestJobsAdapterOptions

Deterministic native adapter time, failure injection and unknown-outcome policy.

**Signature**

```ts
export interface TestJobsAdapterOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: TestClock;
  readonly startTimeMs?: number;
  readonly service?: string;
  readonly unknown?: Partial<Record<"submit" | "cancel" | "retry", boolean>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L6)

### TestObservability

Native engine event capture with ordered protocol/version assertions.

**Signature**

```ts
export interface TestObservability {
  readonly hooks: InspectableObservabilityHooks;
  readonly read: () => readonly ObservabilityHookEvent[];
  readonly types: () => readonly ObservabilityHookEvent["type"][];
  readonly assertTypes: (
    expected: readonly ObservabilityHookEvent["type"][],
  ) => readonly ObservabilityHookEvent[];
  readonly clear: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L70)

### TestProblemResponse

Problem Details response that RelKit routes return for validation and declared errors.

**Signature**

```ts
type TestProblemResponse = TestHttpResponse<ProblemDetails>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/http.types.ts#L20)

### TestProviderReplacements

**Signature**

```ts
declare const TestProviderReplacements: Readonly<
  Partial<
    Record<
      "bucket" | "cache" | "job" | "event" | "model" | "realtime" | "agent-state",
      Readonly<Record<string, unknown>>
    >
  >
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L21)

### TestRuntime

Owned direct invocation runtime with native dependency fakes and complete shutdown.

**Signature**

```ts
export interface TestRuntime {
  readonly stateRoot: string;
  readonly fakes: TestFakes;
  readonly providers: TestProviderReplacements;
  readonly env: Readonly<Record<string, unknown>>;
  readonly clock: TestClock;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Promise<FunctionOutput<Target>>;
  readonly close: (options?: TestRuntimeCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L54)

### TestRuntimeCloseOptions

Explicit failed-test state retention policy for runtime shutdown.

**Signature**

```ts
export interface TestRuntimeCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L41)

### TestRuntimeOptions

Runtime options retaining the concrete application's environment shape.

**Signature**

```ts
export interface TestRuntimeOptions<S extends EnvShape = EnvShape> {
  /** Function registry to use; `createTestApplication` loads the project's when omitted. */
  readonly registry?: FunctionRegistry;
  /** Logger sinks and minimum level; logs are not printed when omitted. */
  readonly logger?: LoggerOptions;
  /** The application whose `env` declarations check and parse the values of `env`. */
  readonly app?: { readonly env: EnvDefinition<S> };
  /** Environment name used to resolve `env`. Defaults to `"test"`. */
  readonly environment?: string;
  /** Values for the application's environment variables; `process.env` is not read. */
  readonly env?: Readonly<Record<string, unknown>>;
  /** Starting time of the test clock, in milliseconds since the epoch. Defaults to `0`. */
  readonly startTimeMs?: number;
  /** Time `close` waits for running work, in milliseconds. Defaults to `1000`. */
  readonly closeTimeoutMs?: number;
  /** Fields that replace the handler context's defaults, such as `auth` or `database`. */
  readonly context?: Readonly<Record<string, unknown>>;
  /** Replacements for provider profiles, by capability then profile name, such as test fakes. */
  readonly providers?: TestProviderReplacements;
  /** Caller-owned roots enable explicit restart tests; omitted roots are temporary. */
  readonly stateRoot?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L17)

### assertObservabilityHookTypes

**Signature**

```ts
declare const assertObservabilityHookTypes: (
  hooks: Pick<InspectableObservabilityHooks, "read">,
  expected: readonly ObservabilityHookEvent["type"][],
) => readonly ObservabilityHookEvent[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L28)

### assertResponseStatus

**Signature**

```ts
declare const assertResponseStatus: (response: Response, expected: number) => Response;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L29)

### createBunHttpListener

**Signature**

```ts
declare const createBunHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L30)

### createDeterministicJobsAdapter

**Signature**

```ts
declare const createDeterministicJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L53)

### createHttpTestClient

**Signature**

```ts
declare const createHttpTestClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L31)

### createJobsConformanceHarness

**Signature**

```ts
declare const createJobsConformanceHarness: (
  options?: TestJobsAdapterOptions,
) => JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L56)

### createObservabilityAssertions

**Signature**

```ts
declare const createObservabilityAssertions: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L32)

### createTestAgentStateProvider

**Signature**

```ts
declare const createTestAgentStateProvider: (root: string) => AgentStateProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L22)

### createTestApplication

**Signature**

```ts
declare const createTestApplication: (
  app: { readonly env: object },
  options?: TestApplicationOptions,
) => Promise<TestApplication>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L17)

### createTestBucket

**Signature**

```ts
declare const createTestBucket: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L23)

### createTestBucketFake

**Signature**

```ts
declare const createTestBucketFake: (options?: TestBucketFakeOptions) => TestBucketFake;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L23)

### createTestCache

**Signature**

```ts
declare const createTestCache: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L25)

### createTestCacheFake

**Signature**

```ts
declare const createTestCacheFake: <
  const KeySchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
  const ValueSchema extends StandardSchemaV1 = StandardSchemaV1<unknown, unknown>,
>(
  options?: TestCacheFakeOptions<KeySchema, ValueSchema>,
) => TestCacheFake<InferInput<KeySchema>, InferOutput<ValueSchema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L25)

### createTestEvent

**Signature**

```ts
declare const createTestEvent: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L61)

### createTestEventFake

**Signature**

```ts
declare const createTestEventFake: <Payload = unknown, Output = unknown>(
  options: TestEventOptions<Payload, Output>,
) => Promise<TestEventFake<Payload, Output>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L61)

### createTestFakes

**Signature**

```ts
declare const createTestFakes: (stateRoot: string, options?: TestFakesOptions) => TestFakes;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L19)

### createTestHttpClient

**Signature**

```ts
declare const createTestHttpClient: (
  app: TestHttpApplication,
  options?: TestHttpClientOptions,
) => TestHttpClient;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L33)

### createTestHttpListener

**Signature**

```ts
declare const createTestHttpListener: (
  app: TestHttpApplication,
  options?: TestHttpListenerOptions,
) => Promise<TestHttpListener>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L34)

### createTestJobsAdapter

**Signature**

```ts
declare const createTestJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L53)

### createTestObservability

**Signature**

```ts
declare const createTestObservability: () => TestObservability;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L35)

### createTestRealtimeProvider

**Signature**

```ts
declare const createTestRealtimeProvider: (root: string) => RealtimeProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L22)

### createTestRuntime

**Signature**

```ts
declare const createTestRuntime: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L10)

### invokeFunction

**Signature**

```ts
declare const invokeFunction: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options?: InvokeFunctionOptions<Context>,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L2)

### responseJson

**Signature**

```ts
declare const responseJson: <T = unknown>(
  response: Response,
  expectedStatus?: number,
) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L36)

### responseText

**Signature**

```ts
declare const responseText: (response: Response, expectedStatus?: number) => Promise<string>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L37)

### runJobsConformance

**Signature**

```ts
declare const runJobsConformance: (
  adapter: JobsAdapterRuntime,
  fixtureIds?: readonly string[],
) => Promise<readonly string[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/index.ts#L57)

## `invoke-function.ts`

### FunctionContextOf

Context inferred from the native handler, preserving required cancellation.

**Signature**

```ts
type FunctionContextOf<Target> =
  Target extends Record<"handler", (input: infer _Input, context: infer Context) => unknown>
    ? Context extends { readonly signal: AbortSignal }
      ? Context
      : InvocationContext
    : InvocationContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L45)

### FunctionInput

Input inferred from the target's native schema authority.

**Signature**

```ts
type FunctionInput<Target extends { readonly input: StandardSchemaV1 }> = InferInput<
  Target["input"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L29)

### FunctionOutput

Output inferred from the target's native schema authority.

**Signature**

```ts
type FunctionOutput<Target extends { readonly output: StandardSchemaV1 }> = InferOutput<
  Target["output"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L37)

### InvokeFunctionOptions

Direct invocation dependencies and native hooks without process environment reads.

**Signature**

```ts
export interface InvokeFunctionOptions<Context extends { readonly signal: AbortSignal }> {
  readonly registry?: FunctionRegistry;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly signal?: AbortSignal;
  readonly now?: () => number;
  readonly idSource?: InvocationIdSource;
  readonly context?: InvocationHooks<Context>["context"];
  readonly hooks?: InvocationHooks<Context>;
  /** The caller that access rules see. Without it, the caller is read from the context's
   * `auth.getSession()` session, which has no session (an anonymous caller) unless the
   * context supplies one, and which carries no permissions. */
  readonly principal?: AccessPrincipalSource;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L56)

### StandaloneFunctionTarget

Native function descriptor retaining input, output and dependency validation.

**Signature**

```ts
export interface StandaloneFunctionTarget {
  readonly id: string;
  readonly input: StandardSchemaV1;
  readonly output: StandardSchemaV1;
  readonly errors?: readonly { readonly id: string; readonly data: StandardSchemaV1 }[];
  readonly dependencies?: import("relkit/engine").DependencyDeclarations;
  readonly publications?: Readonly<Record<string, import("relkit/engine").DependencyRefLike>>;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly handler: (...arguments_: readonly never[]) => MaybePromise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L13)

### invokeFunctionWithRunner

Invokes the existing engine validation path with an explicit Effect runner.

**Signature**

```ts
declare const invokeFunctionWithRunner: <
  const Target extends StandaloneFunctionTarget,
  Context extends { readonly signal: AbortSignal } = FunctionContextOf<Target>,
>(
  target: Target,
  input: FunctionInput<Target>,
  options: InvokeFunctionOptions<Context> | undefined,
  runner?: InvocationRunner,
) => Promise<FunctionOutput<Target>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.ts#L107)

## `invoke-function.types.ts`

### FunctionContextOf (type alias)

Context inferred from the native handler, preserving required cancellation.

**Signature**

```ts
type FunctionContextOf<Target> =
  Target extends Record<"handler", (input: infer _Input, context: infer Context) => unknown>
    ? Context extends { readonly signal: AbortSignal }
      ? Context
      : InvocationContext
    : InvocationContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L45)

### FunctionInput (type alias)

Input inferred from the target's native schema authority.

**Signature**

```ts
type FunctionInput<Target extends { readonly input: StandardSchemaV1 }> = InferInput<
  Target["input"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L29)

### FunctionOutput (type alias)

Output inferred from the target's native schema authority.

**Signature**

```ts
type FunctionOutput<Target extends { readonly output: StandardSchemaV1 }> = InferOutput<
  Target["output"]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L37)

### InvokeFunctionOptions (interface)

Direct invocation dependencies and native hooks without process environment reads.

**Signature**

```ts
export interface InvokeFunctionOptions<Context extends { readonly signal: AbortSignal }> {
  readonly registry?: FunctionRegistry;
  readonly env?: Readonly<Record<string, unknown>>;
  readonly clients?: DependencyClientSources;
  readonly signal?: AbortSignal;
  readonly now?: () => number;
  readonly idSource?: InvocationIdSource;
  readonly context?: InvocationHooks<Context>["context"];
  readonly hooks?: InvocationHooks<Context>;
  /** The caller that access rules see. Without it, the caller is read from the context's
   * `auth.getSession()` session, which has no session (an anonymous caller) unless the
   * context supplies one, and which carries no permissions. */
  readonly principal?: AccessPrincipalSource;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L56)

### StandaloneFunctionTarget (interface)

Native function descriptor retaining input, output and dependency validation.

**Signature**

```ts
export interface StandaloneFunctionTarget {
  readonly id: string;
  readonly input: StandardSchemaV1;
  readonly output: StandardSchemaV1;
  readonly errors?: readonly { readonly id: string; readonly data: StandardSchemaV1 }[];
  readonly dependencies?: import("relkit/engine").DependencyDeclarations;
  readonly publications?: Readonly<Record<string, import("relkit/engine").DependencyRefLike>>;
  readonly timeoutMs?: number;
  readonly concurrency?: number;
  readonly handler: (...arguments_: readonly never[]) => MaybePromise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/invoke-function.types.ts#L13)

## `jobs-conformance.ts`

### JOBS_CONFORMANCE_FIXTURES

**Signature**

```ts
declare const JOBS_CONFORMANCE_FIXTURES: ReadonlyArray<JobsConformanceFixture>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L22)

### JobsConformanceFixture

Native adapter fixture inputs for reusable jobs contract assertions.

**Signature**

```ts
export interface JobsConformanceFixture {
  readonly id: string;
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L7)

### JobsConformanceHarness

Owned native jobs conformance operations and completion controls.

**Signature**

```ts
export interface JobsConformanceHarness {
  readonly adapter: TestJobsAdapter;
  readonly context: OperationContext;
  readonly fixtures: typeof JOBS_CONFORMANCE_FIXTURES;
  readonly run: (fixtureId: string) => Promise<RunHandle | undefined>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L13)

### JobsConformanceProvider

A jobs adapter under test; `close` runs after each case when present.

**Signature**

```ts
type JobsConformanceProvider = JobsAdapterRuntime & {
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L21)

### JobsProviderConformanceOptions

What a jobs provider supplies to run the shared suite.

**Signature**

```ts
export interface JobsProviderConformanceOptions {
  /** Creates an adapter for one case. */
  readonly create: () => JobsConformanceProvider;
  /**
   * Failure injection: an adapter that commits a submission but loses the response, so the
   * submission's outcome is unknown. The `unknown-acknowledgement` case is skipped without it.
   */
  readonly faulty?: () => JobsConformanceProvider;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L26)

### createDeterministicJobsAdapter

**Signature**

```ts
declare const createDeterministicJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L20)

### createJobsConformanceHarness

Creates the deterministic adapter used by native contract fixtures.

**Signature**

```ts
declare const createJobsConformanceHarness: (
  options?: TestJobsAdapterOptions,
) => JobsConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L45)

### createJobsProviderConformanceHarness

Creates the jobs conformance harness for a jobs provider, with the same cases as every
first-party provider. The ambiguous-write case (`unknown-acknowledgement`) runs against the
`faulty` adapter, the provider's own failure injection, and is skipped without one.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import {
  createDeterministicJobsAdapter,
  createJobsProviderConformanceHarness,
} from "@relkit/testing/jobs-conformance";

const harness = createJobsProviderConformanceHarness({
  create: () => createDeterministicJobsAdapter(),
  faulty: () => createDeterministicJobsAdapter({ unknown: { submit: true } }),
});
console.log((await runConformance(harness)).passed);
```

**Signature**

```ts
declare const createJobsProviderConformanceHarness: (
  options: JobsProviderConformanceOptions,
) => ConformanceHarness;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L112)

### runJobsConformance

Executes selected existing native adapter contract fixtures sequentially.

**Signature**

```ts
declare const runJobsConformance: (
  adapter: JobsAdapterRuntime,
  fixtureIds?: readonly string[],
) => Promise<readonly string[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.ts#L71)

## `jobs-conformance.types.ts`

### JobsConformanceFixture (interface)

Native adapter fixture inputs for reusable jobs contract assertions.

**Signature**

```ts
export interface JobsConformanceFixture {
  readonly id: string;
  readonly description: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L7)

### JobsConformanceHarness (interface)

Owned native jobs conformance operations and completion controls.

**Signature**

```ts
export interface JobsConformanceHarness {
  readonly adapter: TestJobsAdapter;
  readonly context: OperationContext;
  readonly fixtures: typeof JOBS_CONFORMANCE_FIXTURES;
  readonly run: (fixtureId: string) => Promise<RunHandle | undefined>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L13)

### JobsConformanceProvider (type alias)

A jobs adapter under test; `close` runs after each case when present.

**Signature**

```ts
type JobsConformanceProvider = JobsAdapterRuntime & {
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L21)

### JobsProviderConformanceOptions (interface)

What a jobs provider supplies to run the shared suite.

**Signature**

```ts
export interface JobsProviderConformanceOptions {
  /** Creates an adapter for one case. */
  readonly create: () => JobsConformanceProvider;
  /**
   * Failure injection: an adapter that commits a submission but loses the response, so the
   * submission's outcome is unknown. The `unknown-acknowledgement` case is skipped without it.
   */
  readonly faulty?: () => JobsConformanceProvider;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-conformance.types.ts#L26)

## `jobs-utils.ts`

### createFailures

Creates isolated named failure injection controls.

**Signature**

```ts
declare const createFailures: () => TestFailureControls;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L37)

### createIdSource

Creates an isolated monotonically sequenced invocation identity source.

**Signature**

```ts
declare const createIdSource: () => InvocationIdSource;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L9)

### createRandom

Creates deterministic retry randomness with upfront fixture validation.

**Signature**

```ts
declare const createRandom: (
  source: (() => number) | undefined,
  values: readonly number[] | undefined,
) => () => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/jobs-utils.ts#L19)

## `native-jobs-observe.ts`

### nativeJobObservation

Publishes owner state availability without polling or sharing observer cursors.

**Signature**

```ts
declare const nativeJobObservation: (
  state: Ref.Ref<NativeJobsState>,
  clock: TestClock,
  service: string,
  request: NativeWatchRequest,
  context: OperationContext,
) => Stream.Stream<
  | {
      readonly kind: "snapshot";
      readonly run: RunSnapshot;
      readonly observedAt: string;
      readonly epoch: string;
      readonly sequence: number;
      readonly cursor?: string;
      readonly continuity: "state" | "history";
    }
  | {
      readonly kind: "update";
      readonly run: RunSnapshot;
      readonly observedAt: string;
      readonly epoch: string;
      readonly sequence: number;
      readonly cursor?: string;
    },
  unknown,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-observe.ts#L19)

## `native-jobs-service.ts`

### TestNativeJobs (class)

Owns authoritative native run state, deterministic time and observation synchronization.

**Signature**

```ts
declare class TestNativeJobs
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-service.ts#L15)

### nativeJobsLayer

Builds one native jobs service, substitutable by providing TestNativeJobs.of in tests.

**Signature**

```ts
declare const nativeJobsLayer: (
  options?: TestJobsAdapterOptions,
) => Layer.Layer<TestNativeJobs, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-service.ts#L24)

## `native-jobs-state.ts`

### notifyNativeJobs

Publishes state availability without buffers or wall-clock polling.

**Signature**

```ts
declare const notifyNativeJobs: (value: NativeJobsState) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs-state.ts#L9)

## `native-jobs.types.ts`

### NativeJobsService (interface)

Effect native jobs adapter decisions with owned worker and observation lifetimes.

**Signature**

```ts
export interface NativeJobsService {
  readonly state: Ref.Ref<NativeJobsState>;
  readonly clock: TestClock;
  readonly submit: (
    ...args: Parameters<JobsAdapterRuntime["submit"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["submit"]>>, unknown>;
  readonly get: (
    ...args: Parameters<JobsAdapterRuntime["get"]>
  ) => Effect.Effect<RunSnapshot, unknown>;
  readonly list: (
    ...args: Parameters<JobsAdapterRuntime["list"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["list"]>>, unknown>;
  readonly cancel: (
    ...args: Parameters<JobsAdapterRuntime["cancel"]>
  ) => Effect.Effect<Awaited<ReturnType<JobsAdapterRuntime["cancel"]>>, unknown>;
  readonly retry: (
    ...args: Parameters<NonNullable<JobsAdapterRuntime["retry"]>>
  ) => Effect.Effect<Awaited<ReturnType<NonNullable<JobsAdapterRuntime["retry"]>>>, unknown>;
  readonly worker: {
    readonly next: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["next"]>
    ) => Effect.Effect<
      Awaited<ReturnType<NonNullable<JobsAdapterRuntime["worker"]>["next"]>>,
      unknown
    >;
    readonly complete: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["complete"]>
    ) => Effect.Effect<void, unknown>;
    readonly fail: (
      ...args: Parameters<NonNullable<JobsAdapterRuntime["worker"]>["fail"]>
    ) => Effect.Effect<void, unknown>;
  };
  readonly observe: (
    ...args: Parameters<NonNullable<JobsAdapterRuntime["observe"]>>
  ) => Stream.Stream<RunWatchFrame<RunSnapshot>, unknown>;
  readonly snapshot: (runId: string) => Effect.Effect<RunSnapshot, unknown>;
  readonly close: Effect.Effect<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs.types.ts#L22)

### NativeJobsState (interface)

Owner-local deterministic run, worker, cursor and observation admission state.

**Signature**

```ts
export interface NativeJobsState {
  readonly runs: Map<string, TestNativeRun>;
  readonly keys: Map<string, string>;
  readonly cancelReceipts: Map<string, Awaited<ReturnType<JobsAdapterRuntime["cancel"]>>>;
  readonly retryReceipts: Map<
    string,
    Awaited<ReturnType<NonNullable<JobsAdapterRuntime["retry"]>>>
  >;
  sequence: number;
  closed: boolean;
  changed: Deferred.Deferred<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/native-jobs.types.ts#L8)

## `provider-replacements.ts`

### TestProviderReplacements

**Signature**

```ts
declare const TestProviderReplacements: Readonly<
  Partial<
    Record<
      "bucket" | "cache" | "job" | "event" | "model" | "realtime" | "agent-state",
      Readonly<Record<string, unknown>>
    >
  >
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L2)

### activateTestProviders

Acquires native providers and wires dependency clients with partial-failure release.

**Signature**

```ts
declare const activateTestProviders: (
  artifacts: TestApplicationArtifacts | undefined,
  replacements: TestProviderReplacements,
  bindingValues: Readonly<Record<string, JsonValue>> | undefined,
  fakes: TestFakes,
  fakeResources?: boolean,
) => Promise<ProviderRegistry | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L50)

### copyTestProviderReplacements

Copies explicit capability/profile replacements before resource acquisition.

**Signature**

```ts
declare const copyTestProviderReplacements: (
  input: TestProviderReplacements | undefined,
) => TestProviderReplacements;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.ts#L21)

## `provider-replacements.types.ts`

### TestProviderReplacements (type alias)

Explicit capability/profile replacements; absent profiles remain native authority decisions.

**Signature**

```ts
type TestProviderReplacements = Readonly<
  Partial<Record<ProviderCapability, Readonly<Record<string, unknown>>>>
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/provider-replacements.types.ts#L4)

## `realtime-conformance.ts`

Shared realtime provider conformance suite. Every first-party realtime provider (local, Redis,
Cloudflare Durable Objects) runs these cases with two instances on one backend, and provider
authors run the same ones.

### "./realtime-conformance.types.js" (namespace export)

Re-exports all named exports from the "./realtime-conformance.types.js" module.

**Signature**

```ts
export * from "./realtime-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.ts#L17)

### REALTIME_CONFORMANCE_CASES

The cases every realtime provider passes.

**Signature**

```ts
declare const REALTIME_CONFORMANCE_CASES: ReadonlyArray<RealtimeConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.ts#L20)

### createRealtimeConformanceHarness

Creates the realtime conformance harness for one provider.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createRealtimeConformanceHarness } from "@relkit/testing/realtime-conformance";
import { createLocalRealtimeProvider } from "relkit/providers-local";

const harness = createRealtimeConformanceHarness({
  create: () => createLocalRealtimeProvider("/tmp/relkit-realtime-conformance", { pollingMs: 50 }),
});
console.log((await runConformance(harness)).passed);
```

**Signature**

```ts
declare const createRealtimeConformanceHarness: (
  options: RealtimeConformanceOptions,
) => ConformanceHarness<RealtimeConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.ts#L55)

## `realtime-conformance.types.ts`

Inputs of the shared realtime provider conformance suite.

### RealtimeConformanceCase (type alias)

One realtime conformance case.

**Signature**

```ts
type RealtimeConformanceCase = ConformanceCase<RealtimeConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.types.ts#L37)

### RealtimeConformanceCaseId (type alias)

Case ids of the realtime suite.

**Signature**

```ts
type RealtimeConformanceCaseId =
  | "wake-on-append"
  | "read-after-checkpoint"
  | "concurrent-appends"
  | "idempotent-append"
  | "wait-deadline"
  | "presence"
  | "backend-failure";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.types.ts#L27)

### RealtimeConformanceOptions (interface)

What a realtime provider supplies to run the suite.

**Signature**

```ts
export interface RealtimeConformanceOptions {
  /**
   * Creates a provider on the shared backend. Each case calls it twice with the same profile and
   * expects both instances to see each other's events, as two server processes would.
   * @param profile - Unique profile for the case.
   */
  readonly create: (profile: string) => RealtimeConformanceProvider;
  /**
   * Failure injection: creates a provider whose backend cannot answer. The `backend-failure` case
   * is skipped without it.
   */
  readonly failing?: () => RealtimeConformanceProvider;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.types.ts#L12)

### RealtimeConformanceProvider (type alias)

A realtime provider under test, with the optional lifecycle methods first-party ones have.

**Signature**

```ts
type RealtimeConformanceProvider = RealtimeProvider & {
  readonly ready?: () => Promise<unknown>;
  readonly close?: () => Promise<unknown>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/realtime-conformance.types.ts#L6)

## `runtime-clock.ts`

### TestDeterministicClock (class)

Manual time and native clock scheduling belong to one deterministic owner.

**Signature**

```ts
declare class TestDeterministicClock
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L137)

### combineSignals

Combines cancellation sources without retaining their listeners after work.

**Signature**

```ts
declare const combineSignals: (...signals: (AbortSignal | undefined)[]) => CombinedSignals;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L117)

### createDeterministicClock

Creates a manually controlled native Effect clock without wall-time polling.

**Signature**

```ts
declare const createDeterministicClock: (startTime: number) => DeterministicClockService;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L13)

### deterministicClockLayer

Provides a replaceable clock service from the native manual-time implementation.

**Signature**

```ts
declare const deterministicClockLayer: (
  startTime?: number,
) => Layer.Layer<TestDeterministicClock, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.ts#L147)

## `runtime-clock.types.ts`

### ClockWaiter (interface)

Owned deterministic deadline and its native completion callback.

**Signature**

```ts
export interface ClockWaiter {
  readonly at: number;
  readonly resume: (effect: Effect.Effect<void>) => void;
  done: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L6)

### CombinedSignals (interface)

Native cancellation signal and the explicit lifetime of its source listeners.

**Signature**

```ts
export interface CombinedSignals {
  readonly signal: AbortSignal;
  readonly dispose: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L20)

### DeterministicClockService (interface)

Manually controlled native clock with an Effect invocation runner.

**Signature**

```ts
export interface DeterministicClockService {
  readonly service: Clock.Clock;
  readonly clock: TestClock;
  readonly run: InvocationRunner["run"];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-clock.types.ts#L13)

## `runtime-close.ts`

### closeRuntime

Waits for bounded admitted work before cleaning temporary ownership.

**Signature**

```ts
declare const closeRuntime: (
  pending: Set<Promise<unknown>>,
  timeoutMs: number,
  cleanup: (failed: boolean) => Effect.Effect<void, unknown>,
  failed: () => boolean,
) => Effect.Effect<void, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-close.ts#L11)

## `runtime-conformance.ts`

Shared runtime adapter conformance suite. The Bun, Node and Workers adapters run these cases
inside the runtime they adapt, and a new adapter runs the same ones. The full HTTP behavior of a
built application (static files, WebSocket echo, streaming) stays in the runtime HTTP suite.

### "./runtime-conformance.types.js" (namespace export)

Re-exports all named exports from the "./runtime-conformance.types.js" module.

**Signature**

```ts
export * from "./runtime-conformance.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.ts#L14)

### RUNTIME_CONFORMANCE_CASES

The cases every runtime adapter passes.

**Signature**

```ts
declare const RUNTIME_CONFORMANCE_CASES: ReadonlyArray<RuntimeConformanceCase>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.ts#L17)

### createRuntimeConformanceHarness

Creates the runtime conformance harness for one adapter. Run it inside the runtime the adapter
adapts.

**Example**

```ts
import { runConformance } from "@relkit/testing/conformance";
import { createRuntimeConformanceHarness } from "@relkit/testing/runtime-conformance";
import { nodeRuntime } from "relkit/runtime/node";

const harness = createRuntimeConformanceHarness({
  adapter: nodeRuntime,
  kind: "process",
  executable: process.execPath,
});
console.log((await runConformance(harness)).results);
```

**Signature**

```ts
declare const createRuntimeConformanceHarness: (
  options: RuntimeConformanceOptions,
) => ConformanceHarness<RuntimeConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.ts#L50)

## `runtime-conformance.types.ts`

Inputs of the shared runtime adapter conformance suite.

### RuntimeConformanceCase (type alias)

One runtime conformance case.

**Signature**

```ts
type RuntimeConformanceCase = ConformanceCase<RuntimeConformanceCaseId>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.types.ts#L37)

### RuntimeConformanceCaseId (type alias)

Case ids of the runtime suite.

**Signature**

```ts
type RuntimeConformanceCaseId =
  | "naming"
  | "crypto"
  | "environment"
  | "serve"
  | "websocket-helper"
  | "files"
  | "processes"
  | "modules";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.types.ts#L26)

### RuntimeConformanceOptions (interface)

What a runtime adapter supplies to run the suite.

**Signature**

```ts
export interface RuntimeConformanceOptions {
  /** The adapter under test, such as `nodeRuntime` from `relkit/runtime/node`. */
  readonly adapter: RuntimeAdapter;
  /**
   * `process` for runtimes with a listener, a filesystem and child processes (Bun, Node);
   * `isolate` for runtimes without them (Cloudflare Workers), whose adapter must refuse those
   * operations instead.
   */
  readonly kind: "process" | "isolate";
  /** A variable set in the environment of the run, read back through the adapter. */
  readonly environment?: { readonly name: string; readonly value: string };
  /** An existing file the `files` case opens (process runtimes). */
  readonly file?: { readonly path: string; readonly contents: string };
  /** Executable of the runtime under test, such as `process.execPath` (process runtimes). */
  readonly executable?: string;
  /** Directory from which the `modules` case resolves `relkit` (process runtimes). */
  readonly resolveFrom?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-conformance.types.ts#L6)

## `runtime-context.ts`

### createTestContextFactory

Creates the validated runtime context defaults with an explicit caller patch.

**Signature**

```ts
declare const createTestContextFactory: (patch: Readonly<Record<string, unknown>>) => ({
  invocation,
  signal,
  env,
  time,
}: InvocationContextOptions) => Readonly<{
  invocation: InvocationRecord;
  signal: AbortSignal;
  env: Readonly<Record<string, unknown>>;
  time: PublicClock;
  log: Readonly<{
    trace: () => void;
    debug: () => void;
    info: () => void;
    warn: () => void;
    error: () => void;
  }>;
  jobs: Readonly<{}>;
  events: Readonly<{}>;
  buckets: Readonly<{}>;
  cache: Readonly<{}>;
  agents: Readonly<{}>;
  database: Readonly<{}>;
  auth: Readonly<{ getSession: () => Promise<null> }>;
  constants: Readonly<{}>;
  prompts: Readonly<{}>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-context.ts#L12)

## `runtime-execution.ts`

### TestRuntimeExecution (class)

Owns invocation admission, cancellation, deterministic dependencies and shutdown.

**Signature**

```ts
declare class TestRuntimeExecution
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.ts#L30)

### testRuntimeLayer

Allocates a synchronously ready runtime domain service after validating all options.

**Signature**

```ts
declare const testRuntimeLayer: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => Layer.Layer<TestRuntimeExecution, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.ts#L41)

## `runtime-execution.types.ts`

### RuntimeExecutionService (interface)

Effect invocation admission and shutdown with deterministic native runtime state.

**Signature**

```ts
export interface RuntimeExecutionService {
  readonly value: Omit<TestRuntime, "invoke" | "close">;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Effect.Effect<FunctionOutput<Target>, unknown>;
  readonly close: (options?: TestRuntimeCloseOptions) => Effect.Effect<void, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-execution.types.ts#L12)

## `runtime-options.ts`

### resolveRuntimeEnv

Resolves explicit values through the application's existing environment authority.

**Signature**

```ts
declare const resolveRuntimeEnv: <S extends EnvShape>(
  options: TestRuntimeOptions<S>,
) => Readonly<Record<string, unknown>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-options.ts#L10)

### validateRuntimeTimeout

Rejects invalid close deadlines before allocating native resources.

**Signature**

```ts
declare const validateRuntimeTimeout: (value: number) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime-options.ts#L63)

## `runtime.ts`

### TestClock

Deterministic native time facade advanced only by explicit test commands.

**Signature**

```ts
export interface TestClock {
  readonly now: () => Date;
  readonly currentTimeMs: () => number;
  readonly advance: (milliseconds: number) => Promise<void>;
  readonly setTime: (timestamp: number) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L46)

### TestRuntime

Owned direct invocation runtime with native dependency fakes and complete shutdown.

**Signature**

```ts
export interface TestRuntime {
  readonly stateRoot: string;
  readonly fakes: TestFakes;
  readonly providers: TestProviderReplacements;
  readonly env: Readonly<Record<string, unknown>>;
  readonly clock: TestClock;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Promise<FunctionOutput<Target>>;
  readonly close: (options?: TestRuntimeCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L54)

### TestRuntimeCloseOptions

Explicit failed-test state retention policy for runtime shutdown.

**Signature**

```ts
export interface TestRuntimeCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L41)

### TestRuntimeOptions

Runtime options retaining the concrete application's environment shape.

**Signature**

```ts
export interface TestRuntimeOptions<S extends EnvShape = EnvShape> {
  /** Function registry to use; `createTestApplication` loads the project's when omitted. */
  readonly registry?: FunctionRegistry;
  /** Logger sinks and minimum level; logs are not printed when omitted. */
  readonly logger?: LoggerOptions;
  /** The application whose `env` declarations check and parse the values of `env`. */
  readonly app?: { readonly env: EnvDefinition<S> };
  /** Environment name used to resolve `env`. Defaults to `"test"`. */
  readonly environment?: string;
  /** Values for the application's environment variables; `process.env` is not read. */
  readonly env?: Readonly<Record<string, unknown>>;
  /** Starting time of the test clock, in milliseconds since the epoch. Defaults to `0`. */
  readonly startTimeMs?: number;
  /** Time `close` waits for running work, in milliseconds. Defaults to `1000`. */
  readonly closeTimeoutMs?: number;
  /** Fields that replace the handler context's defaults, such as `auth` or `database`. */
  readonly context?: Readonly<Record<string, unknown>>;
  /** Replacements for provider profiles, by capability then profile name, such as test fakes. */
  readonly providers?: TestProviderReplacements;
  /** Caller-owned roots enable explicit restart tests; omitted roots are temporary. */
  readonly stateRoot?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L17)

### createTestRuntime

Creates a small deterministic runtime for direct function tests.

**Example**

```ts
import { defineEnv } from "relkit/config";
import { createTestRuntime } from "@relkit/testing";

export async function runtimeExample(): Promise<void> {
  const runtime = createTestRuntime({ app: { env: defineEnv({}) } });
  try {
    await runtime.clock.advance(10);
  } finally {
    await runtime.close();
  }
}
```

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked inference and release.

**Signature**

```ts
declare const createTestRuntime: <S extends EnvShape = EnvShape>(
  options?: TestRuntimeOptions<S>,
) => TestRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.ts#L41)

## `runtime.types.ts`

### TestClock (interface)

Deterministic native time facade advanced only by explicit test commands.

**Signature**

```ts
export interface TestClock {
  readonly now: () => Date;
  readonly currentTimeMs: () => number;
  readonly advance: (milliseconds: number) => Promise<void>;
  readonly setTime: (timestamp: number) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L46)

### TestRuntime (interface)

Owned direct invocation runtime with native dependency fakes and complete shutdown.

**Signature**

```ts
export interface TestRuntime {
  readonly stateRoot: string;
  readonly fakes: TestFakes;
  readonly providers: TestProviderReplacements;
  readonly env: Readonly<Record<string, unknown>>;
  readonly clock: TestClock;
  readonly invoke: <Target extends StandaloneFunctionTarget>(
    target: Target,
    input: FunctionInput<Target>,
    options?: Omit<InvokeFunctionOptions<FunctionContextOf<Target>>, "env" | "now" | "idSource">,
  ) => Promise<FunctionOutput<Target>>;
  readonly close: (options?: TestRuntimeCloseOptions) => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L54)

### TestRuntimeCloseOptions (interface)

Explicit failed-test state retention policy for runtime shutdown.

**Signature**

```ts
export interface TestRuntimeCloseOptions {
  readonly failed?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L41)

### TestRuntimeOptions (interface)

Runtime options retaining the concrete application's environment shape.

**Signature**

```ts
export interface TestRuntimeOptions<S extends EnvShape = EnvShape> {
  /** Function registry to use; `createTestApplication` loads the project's when omitted. */
  readonly registry?: FunctionRegistry;
  /** Logger sinks and minimum level; logs are not printed when omitted. */
  readonly logger?: LoggerOptions;
  /** The application whose `env` declarations check and parse the values of `env`. */
  readonly app?: { readonly env: EnvDefinition<S> };
  /** Environment name used to resolve `env`. Defaults to `"test"`. */
  readonly environment?: string;
  /** Values for the application's environment variables; `process.env` is not read. */
  readonly env?: Readonly<Record<string, unknown>>;
  /** Starting time of the test clock, in milliseconds since the epoch. Defaults to `0`. */
  readonly startTimeMs?: number;
  /** Time `close` waits for running work, in milliseconds. Defaults to `1000`. */
  readonly closeTimeoutMs?: number;
  /** Fields that replace the handler context's defaults, such as `auth` or `database`. */
  readonly context?: Readonly<Record<string, unknown>>;
  /** Replacements for provider profiles, by capability then profile name, such as test fakes. */
  readonly providers?: TestProviderReplacements;
  /** Caller-owned roots enable explicit restart tests; omitted roots are temporary. */
  readonly stateRoot?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/runtime.types.ts#L17)

## `state-providers.ts`

Supplies local realtime and agent-state providers without selecting a native agent engine.

### createTestAgentStateProvider

Constructs the native local agent state provider at an explicit test root.

**Signature**

```ts
declare const createTestAgentStateProvider: (root: string) => AgentStateProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-providers.ts#L20)

### createTestRealtimeProvider

Constructs the native local realtime provider at an explicit test root.

**Signature**

```ts
declare const createTestRealtimeProvider: (root: string) => RealtimeProvider;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-providers.ts#L11)

## `state-root.ts`

### TestStateRoot

Native temporary or caller-owned persistence path with idempotent cleanup.

**Signature**

```ts
export interface TestStateRoot {
  readonly path: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.types.ts#L2)

### createTestStateRoot

Creates an owned temporary state root, or opens a caller-owned restart root.

**Signature**

```ts
declare const createTestStateRoot: (requestedPath?: string) => TestStateRoot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.ts#L12)

## `state-root.types.ts`

Native temporary or caller-owned persistence path with idempotent cleanup.

### TestStateRoot (interface)

Native temporary or caller-owned persistence path with idempotent cleanup.

**Signature**

```ts
export interface TestStateRoot {
  readonly path: string;
  readonly cleanup: (failed: boolean) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/state-root.types.ts#L2)

## `storage-failure.ts`

### InvalidTestSnapshot (class)

Typed invalid transfer boundary translated to the existing public TypeError family.

**Signature**

```ts
declare class InvalidTestSnapshot
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/storage-failure.ts#L4)

## `test-jobs-adapter-controls.ts`

### cancel

Applies the first native cancellation transition and acknowledgement receipt.

**Signature**

```ts
declare const cancel: (
  runs: Map<string, TestNativeRun>,
  receipts: Map<string, NativeControlReceipt>,
  request: NativeCancelRequest,
  unknownOutcome: boolean,
  service: string,
  clock: TestClock,
) => Promise<NativeControlReceipt>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L25)

### retry

Creates a deduplicated native retry with a fresh canonical run identity.

**Signature**

```ts
declare const retry: (
  runs: Map<string, TestNativeRun>,
  receipts: Map<string, NativeControlReceipt>,
  request: NativeRetryRequest,
  unknownOutcome: boolean,
  service: string,
  clock: TestClock,
) => Promise<NativeControlReceipt>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L72)

### unknown

Builds an explicit ambiguous native write result.

**Signature**

```ts
declare const unknown: (
  code: JobUnknownOutcome["code"],
  operationId: string,
  idempotencyKey?: string,
) => JobUnknownOutcome;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-controls.ts#L125)

## `test-jobs-adapter-support.ts`

### TestNativeRun

Mutable deterministic native run state with owned worker cancellation.

**Signature**

```ts
export interface TestNativeRun {
  readonly request: NativeSubmission;
  readonly runId: string;
  readonly acceptedAt: string;
  status: RunSnapshot["status"];
  attempt: number;
  startedAt?: string;
  completedAt?: string;
  output?: unknown;
  error?: JobErrorEnvelope;
  retryOfRunId?: string;
  readonly canonicalInput: JobWireEnvelope;
  controller?: AbortController;
  disposeSignal?: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.types.ts#L5)

### detachedNativeSnapshot

Reads a detached native snapshot, including retained state after owner close.

**Signature**

```ts
declare const detachedNativeSnapshot: (
  state: NativeJobsState,
  runId: string,
  service: string,
  clock: TestClock,
) => RunSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L17)

### failureOf

Projects an unknown worker failure into the existing public envelope.

**Signature**

```ts
declare const failureOf: (value: unknown) => JobErrorEnvelope;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L93)

### isTerminal

Classifies native job terminal lifecycle states.

**Signature**

```ts
declare const isTerminal: (status: RunSnapshot["status"]) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L33)

### requestKey

Builds the existing canonical submission deduplication identity.

**Signature**

```ts
declare const requestKey: (request: NativeSubmission) => string | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L117)

### snapshotOf

Projects a native run using the injected observation clock.

**Signature**

```ts
declare const snapshotOf: (run: TestNativeRun, service: string, clock: TestClock) => RunSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.ts#L49)

## `test-jobs-adapter-support.types.ts`

### TestNativeRun (interface)

Mutable deterministic native run state with owned worker cancellation.

**Signature**

```ts
export interface TestNativeRun {
  readonly request: NativeSubmission;
  readonly runId: string;
  readonly acceptedAt: string;
  status: RunSnapshot["status"];
  attempt: number;
  startedAt?: string;
  completedAt?: string;
  output?: unknown;
  error?: JobErrorEnvelope;
  retryOfRunId?: string;
  readonly canonicalInput: JobWireEnvelope;
  controller?: AbortController;
  disposeSignal?: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-support.types.ts#L5)

## `test-jobs-adapter-work.ts`

### complete

Commits a nonterminal worker's successful native outcome.

**Signature**

```ts
declare const complete: (
  run: TestNativeRun | undefined,
  output: unknown,
  clock: TestClock,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L163)

### createRun

Creates one queued native run using an injected acceptance clock.

**Signature**

```ts
declare const createRun: (
  request: NativeSubmission,
  runId: string,
  retryOfRunId: string | undefined,
  clock: TestClock,
) => TestNativeRun;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L27)

### fail

Commits a nonterminal worker's bounded native failure envelope.

**Signature**

```ts
declare const fail: (
  run: TestNativeRun | undefined,
  error: unknown,
  clock: TestClock,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L181)

### handle

Projects the accepted native run identity.

**Signature**

```ts
declare const handle: (run: TestNativeRun) => RunHandle;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L49)

### list

Filters native runs and returns detached deterministic snapshots.

**Signature**

```ts
declare const list: (
  runs: Map<string, TestNativeRun>,
  query: NativeRunQuery,
  service: string,
  clock: TestClock,
) => RunPage<RunSnapshot>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L68)

### next

Admits one queued native task and binds native cancellation.

**Signature**

```ts
declare const next: (
  runs: Map<string, TestNativeRun>,
  context: OperationContext,
  service: string,
  clock: TestClock,
) => Promise<NativeTaskWork | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter-work.ts#L94)

## `test-jobs-adapter.ts`

### TestJobsAdapter

Owned native jobs adapter with deterministic worker and snapshot test controls.

**Signature**

```ts
export interface TestJobsAdapter extends JobsAdapterRuntime {
  readonly clock: TestClock;
  readonly runNext: () => Promise<import("relkit/jobs/adapter").NativeTaskWork | undefined>;
  readonly snapshot: (runId: string) => RunSnapshot;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L15)

### TestJobsAdapterOptions

Deterministic native adapter time, failure injection and unknown-outcome policy.

**Signature**

```ts
export interface TestJobsAdapterOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: TestClock;
  readonly startTimeMs?: number;
  readonly service?: string;
  readonly unknown?: Partial<Record<"submit" | "cancel" | "retry", boolean>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L6)

### createDeterministicJobsAdapter

Creates a synchronous compatibility adapter over one deterministic jobs owner.

**Signature**

```ts
declare const createDeterministicJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L21)

### createTestJobsAdapter

**Signature**

```ts
declare const createTestJobsAdapter: (options?: TestJobsAdapterOptions) => TestJobsAdapter;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.ts#L111)

## `test-jobs-adapter.types.ts`

### TestJobsAdapter (interface)

Owned native jobs adapter with deterministic worker and snapshot test controls.

**Signature**

```ts
export interface TestJobsAdapter extends JobsAdapterRuntime {
  readonly clock: TestClock;
  readonly runNext: () => Promise<import("relkit/jobs/adapter").NativeTaskWork | undefined>;
  readonly snapshot: (runId: string) => RunSnapshot;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L15)

### TestJobsAdapterOptions (interface)

Deterministic native adapter time, failure injection and unknown-outcome policy.

**Signature**

```ts
export interface TestJobsAdapterOptions {
  readonly logger?: import("relkit/runtime-effect").LoggerOptions;
  readonly clock?: TestClock;
  readonly startTimeMs?: number;
  readonly service?: string;
  readonly unknown?: Partial<Record<"submit" | "cancel" | "retry", boolean>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/test-jobs-adapter.types.ts#L6)

## `testing-owner.ts`

### disposeTestingOwner

Releases an existing owner while retaining native failure identity.

**See**

- tests/fixtures/checked-examples.ts deterministicServicesExample for checked ownership.

**Signature**

```ts
declare const disposeTestingOwner: <R, E>(
  owner: ManagedRuntime.ManagedRuntime<R, E>,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L22)

### runRetainedTestingQuery

Reads retained, resource-free state using the owner's captured observation context.

**Signature**

```ts
declare const runRetainedTestingQuery: <A>(
  context: Context.Context<never>,
  query: Effect.Effect<A, unknown>,
) => Promise<A>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L36)

### testingLoggerLayer

Provisions redacting server logging once at a test helper's ownership boundary.

**See**

- tests/fixtures/checked-examples.ts deterministicServicesExample for checked provisioning.

**Signature**

```ts
declare const testingLoggerLayer: (options?: LoggerOptions) => Layer.Layer<never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/testing-owner.ts#L10)

## `work-ownership.ts`

### admitOwnedWork

Registers scoped work before restoring caller interruption at its join boundary.

**Signature**

```ts
declare const admitOwnedWork: <A>(
  state: WorkOwnershipState,
  scope: Scope.Scope,
  context: Context.Context<never>,
  work: Effect.Effect<A, unknown>,
) => Effect.Effect<A, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L30)

### joinOwnedWork

Joins every actual completion while retaining failed operations as settled work.

**Signature**

```ts
declare const joinOwnedWork: (
  pending: Iterable<Promise<unknown>>,
) => Effect.Effect<void, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L56)

### ownedLifecycle

Owns restart and close ordering without replacing native persistence authorities.

**Signature**

```ts
declare const ownedLifecycle: (
  state: WorkOwnershipState,
  scope: Scope.Scope,
  context: Context.Context<never>,
  release: Effect.Effect<void, unknown>,
  acquire: Effect.Effect<void, unknown>,
  cleanup: (failed: boolean) => Effect.Effect<void>,
  closeOperation: OwnedCloseOperation,
) => {
  restart: Effect.Effect<void, unknown, never>;
  close: (failed?: boolean) => Effect.Effect<void, unknown, never>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L83)

### runOwnedContext

Runs a native facade callback in its already acquired observation context.

**Signature**

```ts
declare const runOwnedContext: <A>(
  context: Context.Context<never>,
  effect: Effect.Effect<A, unknown>,
) => Promise<A>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.ts#L12)

## `work-ownership.types.ts`

Native completion receipts and admission state shared by one scoped harness.

### OwnedCloseOperation (type alias)

Fixed release labels supplied only by the two declaration-owned durable harnesses.

**Signature**

```ts
type OwnedCloseOperation = "job.close" | "event.close";
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.types.ts#L12)

### WorkOwnershipState (interface)

Native completion receipts and admission state shared by one scoped harness.

**Signature**

```ts
export interface WorkOwnershipState {
  readonly kind?: string;
  closed: boolean;
  controller: AbortController;
  pending: Set<Promise<unknown>>;
  restarting?: Promise<void>;
  closing?: Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/packages/testing/src/work-ownership.types.ts#L2)
