Testing¶
The suite has three projects. npm test runs all of them, and npm run check runs them with the rest of the gate.
| Command | Project | What it proves |
|---|---|---|
npm test | all three | every project below, in one run |
npm run test:unit | unit | the handlers, the provider mapping, the settings, the export matcher and the recorded fixture |
npm run test:host | host | the built plugin loads in the embedded OpenCode 2.4.1 host and behaves |
npm run test:pack | pack | the packed tarball installs alone and loads under stock OpenCode |
A single file runs the same way: npx vitest run --project unit test/export.test.ts.
The unit suite¶
test/status.test.ts,test/accounts.test.ts,test/events.test.tsandtest/recent.test.tsdrive the handlers against the synthetic provider.test/provider.test.tspins Plaud's wire shapes: the tool names, the payload readers and the cursor's order.test/settings.test.tsholds the options to their schema and defaults.test/export.test.tscovers the plan and the commit, the destination rules and the atomic write.test/matcher.test.tscompares the export's matcher with the host's ownevaluate, on the cases the two must agree on. If OpenCode changes its matcher, this test fails; the fix is in the plugin, never in the expectation.test/fixture.test.tsreplaysfixtures/conformance.jsonthrough the handlers, so a changed answer fails the test instead of drifting from the recording.
The host suite¶
test/host/ boots a real embedded OpenCode 2.4.1 host on a loopback fake Plaud and loads the built plugin in it. It covers the tool list and the one namespace, the three doors, the access levels, Code Mode, the export's approvals and the external_directory gate, the skills and the pass-through tools. It reads dist/, so run npm run bundle first, as npm run check does.
The pack suite¶
npm pack writes the tarball a consumer installs. test/pack.test.ts checks its file list, extracts it into an empty project, installs it with the host package that stock OpenCode provides, and loads its ./server entry there.
The fixture¶
fixtures/conformance.json is the plugin's evidence to the conformance kit. Its two accounts are synthetic: a deterministic fake Plaud provider in test/fixtures/plaud-provider.ts, driven through the plugin's own handlers. Rebuild it with npm run fixtures.
A plugin with real accounts records with npx plugin-kit record --account <alias> instead, which redacts credentials, emails, phone numbers and home directories before it writes. This repository's fake accounts need no redaction.