
Testing
This is a comprehensive testing guide built around Vitest for what appears to be the LobeHub project. It auto-triggers when you're writing tests, debugging failures, or dealing with mocks. The opinionated take here is refreshing: prefer vi.spyOn over vi.mock, never run the full 3000+ test suite, and there's a whole decision tree for whether to fix or delete failing tests based on whether they test behavior or just internal wiring. It covers webapp, package, and desktop test categories with specific patterns for database models, Electron IPC, and Zustand stores. The "stop after 1-2 failed attempts and ask for help" advice is the kind of pragmatic guidance that prevents hour-long rabbit holes.
- skills.sh installs
- 1.3K
- GitHub stars
- 79.8K
- last updated
- Jul 14, 2026
Install
$ npx -y skills add lobehub/lobe-chat --skill testing --agent claude-codeInstalls into .claude/skills of the current project.
Files
LobeHub Testing Guide
Quick Reference
Commands:
# Run specific test file
bunx vitest run --silent='passed-only' '[file-path]'
# Database package (client-db, PGlite — default, no pg_search; BM25 migrations skip themselves)
cd packages/database && bunx vitest run --silent='passed-only' '[file]'
# Database package (server-db, Postgres — BM25/pgvector parity, what CI measures coverage in)
cd packages/database && TEST_SERVER_DB=1 bunx vitest run --silent='passed-only' '[file]'
Never run bun run test - it runs all 3000+ tests (~10 minutes).
Database models/repositories: every new file under
packages/database/src/models/**orsrc/repositories/**ships with a sibling__tests__/<name>.test.tsin the same PR. Use the real DB viagetTestDB()(integration style), guard BM25/full-text-search blocks withdescribe.skipIf(!isServerDB), and always test user-isolation. Seereferences/db-model-test.mdfor setup, schema gotchas, and the client-vs-server-db split.
Test Categories
Sponsors
Details
- Repository
- github.com/lobehub/lobe-chat
- Category
- Testing & QA
- First seen
- May 16, 2026