Test your plugin
You can test most of a plugin without a Ryot server: backend scripts are plain functions over an input and a host, and screens can be mounted against a fake bridge. Then you try the whole thing on a server.
Let the build check it first
Section titled “Let the build check it first”ryot plugin build already catches a lot: type errors, unknown message keys, unused messages, a
manifest that references a missing script or screen, and queries that do not fit Ryot’s data model.
Run it often. To rebuild every time you save, run this from your plugin folder:
bun run build --watchTest backend scripts
Section titled “Test backend scripts”Use runSandboxTestScript from @ryot-app/plugin-backend-sdk/testing. It decodes the input with
your script’s schema, runs it with a host you supply and decodes the output, just as the sandbox
does. This test checks the water-plant operation from Backend code:
import { expect, test } from "bun:test";
import { Effect } from "@ryot-app/plugin-backend-sdk/effect";import { defineSandboxTestHost, runSandboxTestScript } from "@ryot-app/plugin-backend-sdk/testing";
import waterPlant, { manifest } from "./water-plant.sandbox";
const host = defineSandboxTestHost(manifest, {});const execution = { metadata: {}, sandboxScriptId: "test" };
test("records a watered event on the plant", async () => { const result = await Effect.runPromise( runSandboxTestScript( waterPlant, { plantId: "plant-1", wateredAt: "2026-11-30T09:00:00.000Z" }, host, execution, ), ); expect(result.output).toEqual({ plantId: "plant-1" }); expect(result.changes?.events?.changes).toHaveLength(1);});Run it from the plugin folder:
bun test backenddefineSandboxTestHost takes the host functions your script calls, typed from its manifest. A
script that reads data needs an executeRyotql function that returns rows for the queries it runs;
plugins/fitness/backend/operations/*.test.ts has many examples.
Test screens
Section titled “Test screens”Screen tests mount a page against a fake bridge with mountPluginPage from
@ryot-app/plugin-client-sdk/testing, then check which queries it sent and what it rendered. They
need a DOM, which the repository’s client test runner sets up: the built-in plugins run
bun ../../packages/testing/src/run-client-tests.ts as their test script. Start from the tests in
plugins/fixture/client, such as pokemon-detail.test.tsx.
To check text without React, testPluginText from @ryot-app/plugin-client-sdk/testing renders
your messages, and compilePluginCatalog from @ryot-app/plugin-kit/testing compiles your
catalog for tests.
Try it on a server
Section titled “Try it on a server”Nothing replaces installing the plugin and clicking through it. Two ways to do that:
- A Ryot server you already run. Build, then use Update package in Settings → Plugins
each time. Raise
versionso you can tell builds apart. - A development server from source. Follow Contributing to run Ryot from the repository you are already working in. Installing private plugins still needs Ryot Pro.
Keep in mind that an installed plugin’s data types can only grow. While you are still changing them, uninstall and reinstall instead of updating, after deleting the test items that block the uninstall.