Plugin Testing
Reference for test utilities, patterns, and lint enforcement for FluffBuzz plugins.Test utilities
Import:fluffbuzz/plugin-sdk/testing
The testing subpath exports a narrow set of helpers for plugin authors:
Available exports
| Export | Purpose |
|---|---|
installCommonResolveTargetErrorCases | Shared test cases for target resolution error handling |
shouldAckReaction | Check whether a channel should add an ack reaction |
removeAckReactionAfterReply | Remove ack reaction after reply delivery |
Types
The testing subpath also re-exports types useful in test files:Testing target resolution
UseinstallCommonResolveTargetErrorCases 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 usescreatePluginRuntimeStore, 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:- Which plugins register which providers
- Which plugins register which speech providers
- Registration shape correctness
- Runtime contract compliance
Running scoped tests
For a specific plugin:Lint enforcement (in-repo plugins)
Three rules are enforced bypnpm check for in-repo plugins:
- No monolithic root imports —
fluffbuzz/plugin-sdkroot barrel is rejected - No direct
src/imports — plugins cannot import../../src/directly - No self-imports — plugins cannot import their own
plugin-sdk/<name>subpath
Test configuration
FluffBuzz uses Vitest with V8 coverage thresholds. For plugin tests:Related
- SDK Overview — import conventions
- SDK Channel Plugins — channel plugin interface
- SDK Provider Plugins — provider plugin hooks
- Building Plugins — getting started guide