Class: PluginRuntimeForTests
Runs one plugin instance on the worker side: answers the host's messages and turns the plugin's emits, logs, status and store writes into messages. The same class drives PluginTestHost, so tests exercise exactly what runs in production.
Constructors
Constructor
new PluginRuntimeForTests(
type,send,clock?):PluginRuntime
Parameters
type
send
(message) => void
clock?
Clock = SystemClock.instance
what the plugin's timers and clock.now() run on; tests pass a TestClock
Returns
PluginRuntime
Properties
MAX_TEXT
readonlystaticMAX_TEXT:10000=MessageLimits.TEXT
the longest text a message may carry (the text bound in WorkerMessages); longer log, status and error texts are clipped to it
Accessors
current
Get Signature
get current():
Plugin<unknown> |undefined
the plugin instance after init, for PluginTestHost; undefined before init and after a failed one
Returns
Plugin<unknown> | undefined
Methods
hello()
hello():
void
announces the wire version; the host sends init (or describe) after it
Returns
void
handle()
handle(
raw):Promise<void>
handles one host message; never throws (failures are answered as messages)
Parameters
raw
unknown
Returns
Promise<void>
rejected()
rejected(
reason):void
An unhandled promise rejection in this worker: handed to the plugin, or logged while there is
none (before init, after shutdown). Never throws, so the worker survives a forgotten .catch.
Parameters
reason
unknown
Returns
void