testing/transports/bootstrap.ts

Stateless cross-process bootstrap.

POSTs {bootstrap_path} against the running test binary with the preconfigured token + username + password, parses the BootstrapOutput envelope, captures the session Set-Cookie onto the supplied FetchTransport (which carries it on every subsequent call), and returns the keeper credentials.

Fires exactly once per backend lifetime — spawn_backend calls it inside vitest's globalSetup. Per-test fixtures re-use the captured keeper credentials; fresh per-test accounts come from fixture.create_account() (signup+login through production RPC), not re-bootstrap. The hybrid reset model in default_cross_process_setup depends on this — re-bootstrap would race the bootstrap lock and in-memory caches.

Declarations
#

3 declarations

view source

bootstrap
#

testing/transports/bootstrap.ts view source

(options: BootstrapOptions): Promise<BootstrapResult>

Fire POST {config.bootstrap_path} and capture the keeper session.

options

returns

Promise<BootstrapResult>

throws

  • Error - when the binary refuses bootstrap (non-2xx response) or

BootstrapOptions
#

testing/transports/bootstrap.ts view source

BootstrapOptions

Input for bootstrap().

transport

The cookie-threading HTTP transport pointed at the binary. After bootstrap() resolves, the transport carries the keeper session cookie — every later call against it is authenticated as keeper.

readonly

config

Backend config — used for bootstrap_path plus the bootstrap.username / bootstrap.password / bootstrap.token credentials. The runner already wrote bootstrap.token to bootstrap.token_path before spawning, so the binary picks the token up at startup.

readonly

BootstrapResult
#

testing/transports/bootstrap.ts view source

BootstrapResult

The keeper credentials captured from POST /api/account/bootstrap.

transport

Same transport that came in, now carrying the keeper session cookie in its jar. Returned for call-site clarity (callers don't have to remember the mutation happens in place).

readonly

account

Account JSON returned by POST /bootstrap.

type {readonly id: Uuid; readonly username: string}
readonly

actor

Actor JSON returned by POST /bootstrap.

type {readonly id: Uuid}
readonly

cookies

Raw Set-Cookie values for threading into a WS transport.

type ReadonlyArray<string>
readonly

Depends on
#

Imported by
#