Variable: testing
> const testing: object
Defined in: src/index.ts:532
Lets an AI agent (or any external script/browser console) drive and inspect a running game
through window, without needing to know the app's own UI wiring. Not enabled by default —
something must opt in, typically only in development. Two pieces are needed:
enable()/disable()turn thewindowbridge on/off — the@drincs/pixi-vn/viteplugin'stestingoption does this automatically while its dev server is running, with no extra code.setProps(props)keeps the live app props (navigate/t/toast/etc.) available to every action — call it unconditionally from wherever your app builds those props (e.g. at the end of auseGameProps()-style hook), since every action needs up-to-date props whether or not testing happens to be enabled right now.setActions(actions)is optional: if the app wrapsnarration/stepHistoryin its own functions to handle UI-only concerns (a loading indicator, blocking while a menu is open, refreshing cached interface data, ...), it can register those functions socontinue(),goBack(),selectChoice(),start(),jump()andcall()drive the game through them instead of callingnarration/stepHistorydirectly — same as a real player action would. See thepixi-vn-testingskill for the full guide (activation patterns, the complete command surface, and cookbook snippets for a browser-driven test session).
Type Declaration
disable
> disable: () => void
Disables a session started with enable: removes the error handler and, if it's
still the current value, deletes window[windowKey]. No-op if testing isn't enabled.
Returns
void
enable
> enable: <T>(options?) => GameTestingAPI<typeof Game, T>
Enables the testing API: builds it, attaches it to window[windowKey] (default
"pixiVN"), and returns it. Calling this again replaces the previous session.
Type Parameters
T
T extends object = { }
Parameters
options?
windowKey?
string
The property name to attach the API under on window.
Returns
GameTestingAPI<typeof Game, T>
Default
"pixiVN"isEnabled
> isEnabled: () => boolean
Whether a testing session is currently active.
Returns
boolean
setActions
> setActions: <T>(actions) => void
Registers the app's own narration functions so GameTestingAPI's continue,
goBack, selectChoice, start, jump and call call them instead of going straight to
narration/stepHistory — useful when the app wraps those with UI-only concerns (e.g. a
loading indicator, blocking while a menu is open, refreshing cached interface data) that a
test session driving the game through window should also go through, exactly like a real
player action would. Safe to call whether or not testing is currently enabled, and
safe to call again to update the registered functions (e.g. when they close over fresh
props). Persists across disable/enable, same as setProps.
Type Parameters
T
T extends object = { }
Parameters
actions
The app's own narration functions to use in place of the defaults. Pass {}
(or omit an action) to keep/restore the default behavior for that action.
Returns
void
setProps
> setProps: <T>(props) => void
Updates the live props every GameTestingAPI action merges extraProps on top of.
Call this unconditionally from wherever your app builds its StepLabelProps (e.g. the end
of a useGameProps()-style hook that already runs throughout the app) — it's a cheap
assignment, safe to call whether or not testing is currently enabled.
Type Parameters
T
T extends object = { }
Parameters
props
The app's current StepLabelProps (the same object your UI passes to
narration.continue/Game.start).
Returns
void