testing/cross_backend/setup.ts view source
BootstrappedBackendHandle import type {BootstrappedBackendHandle} from '@fuzdev/fuz_app/testing/cross_backend/setup.js'; Cross-process backend handle enriched with the bootstrapped keeper's
captured credentials. Consumers compose this in vitest's
globalSetup:
const handle = await spawn_backend(config);
const keeper_transport = create_fetch_transport({base_url: config.base_url});
const keeper = await bootstrap({transport: keeper_transport, config});
const bootstrapped: BootstrappedBackendHandle = {
...handle,
keeper_transport,
keeper_daemon_transport: create_fetch_transport({
base_url: config.base_url,
initial_cookies: keeper.cookies,
origin: null,
}),
keeper_account: keeper.account,
keeper_actor: keeper.actor,
keeper_cookies: keeper.cookies,
};default_cross_process_setup(bootstrapped, options) reads from this
shape — the per-test fixture closes over the keeper credentials so
cross-process tests can drive admin-RPC / audit-observer flows
against the long-lived bootstrapped admin alongside the per-test
signup+login account.
inheritance
keeper_transport
Transport carrying the keeper session cookie + cookie jar.
type (url: string, init: RequestInit): Promise<Response>
url
stringinit
RequestInitPromise<Response>keeper_daemon_transport
Daemon-token transport for the keeper — same cookie jar as
keeper_transport but with origin: null so it sends no Origin
header. The daemon-token middleware discards the credential in a
browser context (any Origin / Referer), so the _testing_*
daemon-token calls (_testing_reset / _testing_schema_snapshot /
_testing_action_manifest / _testing_mint_session) must route
through this Origin-free transport. CSRF/cookie-session calls
(invite_create, role_grant_offer_create) stay on keeper_transport,
which keeps its default Origin.
type (url: string, init: RequestInit): Promise<Response>
url
stringinit
RequestInitPromise<Response>keeper_account
Keeper account JSON captured from POST /bootstrap.
type { readonly id: Branded<string, "Uuid">; readonly username: string; }
keeper_actor
Keeper actor JSON captured from POST /bootstrap.
type { readonly id: Branded<string, "Uuid">; }
keeper_cookies
Raw keeper Set-Cookie values — thread into ws_transport for keeper-authenticated WS upgrades.
type readonly string[]