feat: add vitest testing infrastructure#526
Open
ventilla wants to merge 1 commit intoobsidianmd:masterfrom
Open
feat: add vitest testing infrastructure#526ventilla wants to merge 1 commit intoobsidianmd:masterfrom
ventilla wants to merge 1 commit intoobsidianmd:masterfrom
Conversation
Add vitest with 74 passing tests covering util, mime, template, and filesystem modules. Includes obsidian module mock and fixture docs. - vitest + @vitest/coverage-v8 as dev dependencies - __mocks__/obsidian.ts for runtime module mocking - tests/unit/ with 4 test files (util, mime, template, filesystem) - tests/fixtures/README.md documenting snapshot testing patterns - npm scripts: test, test:watch, test:coverage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
util,mime,template, andfilesystemmodules__mocks__/obsidian.ts— mock for theobsidianruntime module so source files need zero test-specific changesvitest.config.ts— standalone config (no coupling to esbuild build)tests/fixtures/README.md— documents existing fixture directories and snapshot testing patternstest,test:watch,test:coverageHow to extend
New importer tests go in
tests/unit/formats/<name>.test.ts. The existing fixture files (bear, csv, evernote, html, journal, keep, notion, roam, textbundle, tomboy) can be used for snapshot tests. Seetests/fixtures/README.mdfor patterns.Test results
Design decisions
resolve.aliasin vitest config redirectsobsidianimports to mock — no source changes needed.src/formats/**(heavy Obsidian API coupling). Format tests can be added incrementally as mocking improves.🤖 Generated with Claude Code