obsidian-plugin-test

Automate Obsidian plugin test suites with Vitest and mocked Vault APIs.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/magarcia/pylon-sync --skill obsidian-plugin-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: obsidian-plugin-test
Source: https://github.com/magarcia/pylon-sync/tree/main/.agents/skills/obsidian-plugin-test
Command: npx skills add https://github.com/magarcia/pylon-sync --skill obsidian-plugin-test

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Testing Obsidian plugin logic outside the Obsidian runtime is impossible without runtime mocks, so this skill documents how to structure vitest suites and simulate Vault and provider APIs to validate syncing logic reliably.

Core Features & Use Cases

  • Testing Strategy Overview: Emphasizes pure logic tests, mock-based vault operations, mocked HTTP requests, and reserves UI concerns for manual verification.
  • Mock Implementations: Supplies TFile, MockVault, requestUrl, and UI stubs plus helper utilities for seeding files and emitting vault events to keep suites deterministic.
  • Use Case: Developers seed the MockVault, run scan/reconciler/provider logic, and assert outcomes without opening Obsidian while sharing mock definitions across suites.

Quick Start

Ask the obsidian-plugin-test skill to walk through setting up Vitest and mocking the Obsidian Vault for your plugin function.

Frequently Asked Questions about obsidian-plugin-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test Obsidian plugin logic without running the Obsidian runtime?

Mocking the Obsidian Vault for vitest lets you validate plugin logic without launching the Obsidian runtime. You seed a MockVault, run scan or reconciler functions, and assert outcomes purely in Node.

What is the best way to mock the Obsidian Vault API in vitest?

Mocking the Obsidian Vault in vitest involves using provided TFile and MockVault stubs to seed files and emit vault events. This keeps integration test suites deterministic without relying on the live runtime.

Can I simulate requestUrl HTTP calls in my Obsidian plugin test suite?

Yes, you simulate requestUrl HTTP calls in Obsidian plugin tests by mocking the provider API via vitest aliases. This validates syncing logic reliably without actual network requests or the Obsidian runtime.

Does vitest work with Obsidian plugin provider code for integration testing?

Vitest works with Obsidian plugin provider code by using aliases to reference mock implementations. You run integration tests for vault scanning and reconciling logic across your monorepo without the live runtime.

Why does my Obsidian plugin test fail when accessing vault APIs?

Obsidian plugin tests fail when accessing vault APIs because the runtime is unavailable outside the application. You must mock TFile, MockVault, and platform APIs via vitest aliases to ensure consistent behavior.