Test a plugin
Test a plugin's logic with a test runner, then check it inside a running DSUI by listing plugins and calling its endpoints.
On this page
You can test a plugin in two layers. Test its logic on its own, then run it in DSUI and call what it offers. This page uses the plugin from the tutorial.
Test the logic#
A plugin’s definitions are plain TypeScript, so any test runner works, such as bun test. Keep logic in functions that you can call without DSUI. Test the settings schema for its defaults, and test a procedure handler with a fake context:
import { expect, test } from "bun:test";
import { configSchema } from "./config";
test("greeting defaults to Hello", () => {
expect(configSchema.parse({}).greeting).toBe("Hello");
});Check it in a running DSUI#
Start DSUI with your plugin in dsui.yaml, then list the plugins. status is ready, disabled, or unavailable, and an unavailable plugin carries the reason in detail:
curl http://localhost:4192/api/v1/pluginsThe same list shows the plugin’s pages, navigation entries, and slots. Settings, then Extensions shows the status in the workspace.
Call what the plugin offers:
# Render a page
curl http://localhost:4192/api/v1/plugins/hello-plugin/pages/services
# Call a procedure. The body is the input
curl --request POST \
--header "Content-Type: application/json" \
--data '{"name": "Ada"}' \
http://localhost:4192/api/v1/plugins/hello-plugin/procedures/greetA resource works the same way at /resources/<resource id>. Restart DSUI after a change, because DSUI loads plugins once, when it starts.
Fix common load errors#
| Message | Cause |
|---|---|
Package declares plugin id "a" but is configured as "b" | The key under plugins must equal metadata.id |
Security plugins require critical: true | A plugin with security: true needs critical: true in dsui.yaml |
Invalid configuration for a source: git plugin | The entry has fields that plugins don’t accept, such as commit and integrity. Use ref |
A 422 from a procedure | The input or the output doesn’t match its schema |
Test inside the DSUI repository#
If you work on DSUI itself, run the checks of a package from the repository root:
bun run --filter @northgraindata/dsui-plugin-sdk test
bun run --filter @northgraindata/dsui-plugin-sdk typecheckThe product’s own CI runs the integration checks for service authorization, error redaction, durable jobs, and browser bundle loading.