Module: rstest
Interfaces
AgentBundleBrowserRstestConfig
Properties
browser
browser:
object
enabled
enabled:
true
headless
headless:
true
provider
provider:
"playwright"
providerOptions
providerOptions:
object
providerOptions.launch
launch:
object
providerOptions.launch.channel
channel:
"chrome"
viewport
viewport:
object
viewport.height
height:
900
viewport.width
width:
1440
include
include:
string[]
resolve
resolve:
object
Routes the reserved agent-bundle/meta specifier to the generated identity module.
alias
alias:
object
Index Signature
[specifier: string]: string
setupFiles
setupFiles:
string[]
source?
optionalsource?:object
tsconfigPath
tsconfigPath:
string
tools
tools:
object
rspack
rspack:
object
rspack.resolve
resolve:
object
rspack.resolve.extensionAlias
extensionAlias:
object
rspack.resolve.extensionAlias..js
.js:
string[]
rspack.resolve.extensionAlias..jsx
.jsx:
string[]
swc
swc:
object
swc.jsc
jsc:
object
swc.jsc.transform
transform:
object
swc.jsc.transform.react
react:
object
swc.jsc.transform.react.runtime
runtime:
"automatic"
AgentBundleBrowserRstestOptions
Properties
configPath?
readonlyoptionalconfigPath?:string
Explicit Agent Bundle configuration path; discovered from root when omitted.
include?
readonlyoptionalinclude?: readonlystring[]
Test files for the browser-app level; defaults to tests/browser-app/**.
root?
readonlyoptionalroot?:string
Project root; defaults to the working directory Rstest was started in.
setupFiles?
readonlyoptionalsetupFiles?: readonlystring[]
Extra setup files, appended after the generated browser registry.
target?
readonlyoptionaltarget?:string
Mounts every app as this host: the preview profile and the binding's
target the page sees. By default each app mounts as its first declared
target that the project also selects. The apps themselves are compiled
once for the project's whole selection, as the build stages them (#555) —
the host is projection context for the harness, never part of the
compiled bytes (#592).
AgentBundleRstestConfig
The Rstest configuration for the route-unit proof level. Mutable array and
literal member types keep the result directly assignable to Rstest's own
config type without this package depending on @rstest/core.
Properties
include
include:
string[]
pool
pool:
object
execArgv
execArgv:
string[]
type
type:
"forks"
resolve
resolve:
object
Routes the reserved agent-bundle/meta specifier to the generated identity module.
alias
alias:
object
Index Signature
[specifier: string]: string
setupFiles
setupFiles:
string[]
source?
optionalsource?:object
tsconfigPath
tsconfigPath:
string
testEnvironment
testEnvironment:
"node"
tools
tools:
object
rspack
rspack:
object
rspack.resolve
resolve:
object
rspack.resolve.conditionNames
conditionNames:
string[]
swc
swc:
object
swc.jsc
jsc:
object
swc.jsc.transform
transform:
object
swc.jsc.transform.react
react:
object
swc.jsc.transform.react.runtime
runtime:
"automatic"
AgentBundleRstestOptions
Properties
configPath?
readonlyoptionalconfigPath?:string
Explicit Agent Bundle configuration path; discovered from root when omitted.
include?
readonlyoptionalinclude?: readonlystring[]
Test files for the route-unit level; defaults to tests/route-unit/**.
root?
readonlyoptionalroot?:string
Project root; defaults to the working directory Rstest was started in.
setupFiles?
readonlyoptionalsetupFiles?: readonlystring[]
Extra setup files, appended after the generated route registry.
AgentBundleTestManifest
What the compiler tells the test harness about one project: the route and MCP App inventories, the project identity its generated servers advertise, the selected targets, and the compiler's own diagnostics. Artifact descriptors arrive with the stage that can honestly prove them.
Properties
apps
readonlyapps:Readonly<Record<string,TestableAppDescriptor>>
Collision-checked MCP App declarations from the same compiler pass.
cliCommands
readonlycliCommands: readonlyCompiledCliCommand[]
The collision-checked routed-CLI command graph (#102 stage 2) from the
same pass, so the CLI dispatch level drives the product's own dispatcher
over the product's own commands instead of resolving argv itself. Empty
when the project compiles no src/cli/** commands.
configPath?
readonlyoptionalconfigPath?:string
The absolute config path the compiler pass evaluated.
diagnostics
readonlydiagnostics: readonlyDiagnostic[]
Diagnostics from the same pass, so a harness failure can name a compiler cause.
digest
readonlydigest:string
The route graph digest: project-relative route identity, equal on every machine.
eventRuntimeServerId?
readonlyoptionaleventRuntimeServerId?:string
Generated MCP server that owns the shared event runtime, when event routes and a generated server coexist.
layouts
readonlylayouts: readonlyTestableLayoutDescriptor[]
Conventional layouts from the same pass, ordered by id; empty when the project declares none.
plugin
readonlyplugin:TestManifestPluginIdentity
Plugin name and version, as the generated MCP server reports them in initialize.
projectRoot
readonlyprojectRoot:string
proofLevel
readonlyproofLevel:AgentTestProofLevel
The level the manifest and its registered loaders alone supply; every other level stamps its own.
providers?
readonlyoptionalproviders?: readonlyTestableProviderDescriptor[]
Conventional request context providers, in the execution order every
generated request scope uses; the harness mounts them automatically unless
a test passes context.providers. Absent when the project declares none.
routes
readonlyroutes:Readonly<Record<string,TestableRouteDescriptor>>
scripts
readonlyscripts: readonlyTestableScriptDescriptor[]
The conventional src/scripts/* modules from the same pass, collision-
checked by name, so the script-dispatch level runs the product's own
script contract instead of guessing at file extensions. Empty when the
project compiles no conventional scripts.
state?
readonlyoptionalstate?:TestableStateDescriptor
Conventional project state mounted automatically for manifest route renders.
targets
readonlytargets: readonlystring[]
Host targets the project selected. Route-unit rendering is target-neutral; these name the projection surfaces a later proof level owns.
TestableProviderDescriptor
One conventional src/providers/<name>.ts context provider the harness
mounts for every manifest request scope, exactly as the generated entries
do (#313). key is the camel-cased request-context key.
Properties
id
readonlyid:string
key
readonlykey:string
name
readonlyname:string
relativePath
readonlyrelativePath:string
Project-relative POSIX path of the provider module.
source
readonlysource:string
Absolute provider module path.
TestableRouteDescriptor
One compiled route the harness can address, with the identity its diagnostics report.
Properties
config
readonlyconfig:Readonly<Record<string,unknown>>
The route module's statically extracted config export; {} when absent.
event?
readonlyoptionalevent?:"session/start"|"tool/before"|"tool/after"|"stop"|"agent/start"|"agent/stop"|"workspace/open"|"session/end"|"prompt/submit"|"tool/failure"|"compact/before"|"compact/after"|"permission/request"|"permission/denied"|"stop/failure"|"file/change"|"config/change"|"task/create"|"task/complete"|"agent/idle"|"model-switch/before"|"model-switch/after"
Canonical event identity; present only for event routes.
id
readonlyid:string
kind
readonlykind:CompiledRouteKind
relativePath
readonlyrelativePath:string
Project-relative POSIX path of the route module.
serverId?
readonlyoptionalserverId?:string
The owning MCP server id (mcp:<name>); MCP route kinds only.
source
readonlysource:string
Absolute route module path.
TestableStateDescriptor
The conventional state module the generated route-unit registry can load.
Properties
id
readonlyid:string
lifetime
readonlylifetime:"request"|"process"|"workspace-durable"
relativePath
readonlyrelativePath:string
source
readonlysource:string
Variables
agentBundleBrowserRstest
constagentBundleBrowserRstest: (options?) =>Promise<AgentBundleBrowserRstestConfig>
Parameters
options?
AgentBundleBrowserRstestOptions
Returns
Promise<AgentBundleBrowserRstestConfig>
agentBundleRstest
constagentBundleRstest: (options?) =>Promise<AgentBundleRstestConfig>
Builds the Rstest configuration for a consumer project's route-unit tests.
One compiler pass runs here — the same preparation the build and inspect
use, which owns route-graph compilation — and its manifest configures the
pool, the test environment, the TypeScript transform, and the generated
route registry the helpers in agent-bundle/test read. No artifact is built.
The same pass supplies the project identity, so the configuration aliases
agent-bundle/meta to a generated module carrying exactly the
{ name, packageName, packageVersion, version } a build would stamp: any
source module importing it loads under the pool instead of raising AB4760.
When preparation produced no plugin model there is no identity to stamp, and
the aliased module throws AB4760 naming the compiler diagnostics instead
of serving the manifest placeholder.
This configuration carries the route-unit level only. Transport, browser, and packed-artifact proof levels arrive as their own configurations.
Parameters
options?
Returns
Promise<AgentBundleRstestConfig>