Test tools for Vestra Player plugins: an in-memory fake player
(TestHost) and startPlugin, which activates a plugin against
it.
TestHost speaks the real wire protocol, so the SDK's own logic (revisions,
conditional commits, recovery after lost replies, coalescing of updates)
runs exactly as it does inside the player. Only the player side is faked,
and its semantics are simplified:
no Slint and no native windows: views are records of their properties
and callbacks (FakeWindow), and you fire callbacks yourself;
export jobs advance one step on every state query
(queued → running → completed);
video and audio processing nodes are validated with the player's own
value ranges (an out-of-range filter.set ends in failed with
invalid), an empty chain removes the plugin's chain, a chain on a
generated stream fails unsupported (the player's own conformance
cases check all three), and the command limits (COMMAND_LIMITS),
property value limits (UI_VALUE_LIMITS) and menu ids
(MENU_IDS) are enforced.
Typical workflow: start the plugin with startPlugin (it reads the
plugin's manifest.json), drive it the way the user or another plugin
would (run commands, press bindings, fire view callbacks, change the
source), wait with TestHost.settle, assert on what the host
recorded (host.osd, host.window(id).props, host.sent(method), …), and
finally call stop().
Use it from node:test (what vestra-plugin test runs). Each test should
create its own host; stop() removes the host's temporary directories.
Example: Test that a menu item shows a message
A complete test file: it activates the plugin against an in-memory
player, picks its Hello menu item and checks what the OSD showed.
startPlugin reads the plugin's manifest.json from directory, calls
activate and waits for its registrations; run() executes the command
as the menu would and waits until the host is idle. stop() disposes
the plugin and removes the host's temporary files, even when an
assertion fails.
Test tools for Vestra Player plugins: an in-memory fake player (TestHost) and startPlugin, which activates a plugin against it.
TestHostspeaks the real wire protocol, so the SDK's own logic (revisions, conditional commits, recovery after lost replies, coalescing of updates) runs exactly as it does inside the player. Only the player side is faked, and its semantics are simplified:queued→running→completed);filter.setends infailedwithinvalid), an empty chain removes the plugin's chain, a chain on a generated stream failsunsupported(the player's own conformance cases check all three), and the command limits (COMMAND_LIMITS), property value limits (UI_VALUE_LIMITS) and menu ids (MENU_IDS) are enforced.Typical workflow: start the plugin with startPlugin (it reads the plugin's
manifest.json), drive it the way the user or another plugin would (run commands, press bindings, fire view callbacks, change the source), wait with TestHost.settle, assert on what the host recorded (host.osd,host.window(id).props,host.sent(method), …), and finally callstop().Use it from
node:test(whatvestra-plugin testruns). Each test should create its own host;stop()removes the host's temporary directories.Example: Test that a menu item shows a message
A complete test file: it activates the plugin against an in-memory player, picks its Hello menu item and checks what the OSD showed.
startPluginreads the plugin'smanifest.jsonfromdirectory, callsactivateand waits for its registrations;run()executes the command as the menu would and waits until the host is idle.stop()disposes the plugin and removes the host's temporary files, even when an assertion fails.