Skip to main content
Reference for test utilities, patterns, and lint enforcement for FluffBuzz plugins.
Looking for test examples? The how-to guides include worked test examples: Channel plugin tests and Provider plugin tests.

Test utilities

Import: fluffbuzz/plugin-sdk/testing The testing subpath exports a narrow set of helpers for plugin authors:

Available exports

Types

The testing subpath also re-exports types useful in test files:

Testing target resolution

Use installCommonResolveTargetErrorCases to add standard error cases for channel target resolution:

Testing patterns

Unit testing a channel plugin

Unit testing a provider plugin

Mocking the plugin runtime

For code that uses createPluginRuntimeStore, mock the runtime in tests:

Testing with per-instance stubs

Prefer per-instance stubs over prototype mutation:

Contract tests (in-repo plugins)

Bundled plugins have contract tests that verify registration ownership:
These tests assert:
  • Which plugins register which providers
  • Which plugins register which speech providers
  • Registration shape correctness
  • Runtime contract compliance

Running scoped tests

For a specific plugin:
For contract tests only:

Lint enforcement (in-repo plugins)

Three rules are enforced by pnpm check for in-repo plugins:
  1. No monolithic root importsfluffbuzz/plugin-sdk root barrel is rejected
  2. No direct src/ imports — plugins cannot import ../../src/ directly
  3. No self-imports — plugins cannot import their own plugin-sdk/<name> subpath
External plugins are not subject to these lint rules, but following the same patterns is recommended.

Test configuration

FluffBuzz uses Vitest with V8 coverage thresholds. For plugin tests:
If local runs cause memory pressure: