Skip to content

API

ogygia/plugin/testing

Run a plugin's server realm in a unit test, without a server.

On this page

This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source.

import { … } from 'ogygia/plugin/testing';

Exports clear_route_config · route_config · set_page_route_config · startPlugin · StartedPlugin

clear_route_config

function

Tests only.

function clear_route_config(): void;

route_config

function

This request's value for key in its route's merged config, or undefined (use the plugin's default). A null routeId is never normalized to / — that would be a different route.

function route_config(key: string, route_id: string | null | undefined, pathname: string): unknown;

set_page_route_config

function

Core only (hooks.ts): the Kit pages' merged config, baked by the compiler.

function set_page_route_config(pages: Record<string, RouteConfig>): void;

startPlugin

function

function startPlugin<Options = undefined, State = undefined>(server: ServerPlugin<Options, State>, { name, options }?: {
  name?: string;
  options?: Options;
}): StartedPlugin<Options, State>;

StartedPlugin

interface

interface StartedPlugin<Options, State> {/*…*/}

StartedPlugin.app

app: ServerApp<Options>;

StartedPlugin.ctx

A request context for request (a bare event: url, request, cookies that read nothing).

ctx(request: Request, event?: Partial<RequestEvent>): RequestContext<Options, State>;