Plugin Testing Skill — obsidian-plugin-template
Note: Always prefer
pnpmovernpmif possible. Usepnpmfor all commands unless you have a specific reason to usenpm. Both are shown below for compatibility.
Use this skill to guide both automated and manual testing of Obsidian plugin features. Ensure all tests reflect real plugin usage and production-like conditions.
Key Testing Principles
- •Always build the plugin before testing (
pnpm build). - •Use the install script to deploy to a test vault (
pnpm obsidian:install <vault>preferred). - •Helpful scripts for testing:
- •
pnpm build— build before running tests or manual testing - •
pnpm obsidian:install <vault>— install the built plugin into a test vault - •
pnpm run format— format code before testing if needed - •
pnpm run check— run lint & formatting checks
- •
- •Test settings UI for load, save, and persistence.
- •Validate localization for all supported languages.
- •Confirm plugin lifecycle events (load/unload) work as expected.
For the full list and usage of scripts, see the Scripts (package.json) section in AGENTS.md.
Example Test Workflow
- •Build:
- •Run:
pnpm build(preferred) ornpm run build
- •Run:
- •Install:
- •Run:
pnpm obsidian:install <vault directory>(preferred).
- •Run:
- •Settings UI:
- •Open plugin settings in Obsidian
- •Change and save settings; reload plugin and verify persistence
- •Localization:
- •Switch Obsidian language; verify all UI text updates accordingly
- •Lifecycle:
- •Reload or disable/enable the plugin; ensure all managers register/unload cleanly
References
- •See src/main.ts for plugin entry and lifecycle
- •For integration, ensure settings and localization are loaded as in production