Esc
Documentation
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:

ts
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:

bash
curl http://localhost:4192/api/v1/plugins

The 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:

bash
# 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/greet

A 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#

MessageCause
Package declares plugin id "a" but is configured as "b"The key under plugins must equal metadata.id
Security plugins require critical: trueA plugin with security: true needs critical: true in dsui.yaml
Invalid configuration for a source: git pluginThe entry has fields that plugins don’t accept, such as commit and integrity. Use ref
A 422 from a procedureThe 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:

bash
bun run --filter @northgraindata/dsui-plugin-sdk test
bun run --filter @northgraindata/dsui-plugin-sdk typecheck

The product’s own CI runs the integration checks for service authorization, error redaction, durable jobs, and browser bundle loading.