lobehub avatar

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-code

Installs 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/** or src/repositories/** ships with a sibling __tests__/<name>.test.ts in the same PR. Use the real DB via getTestDB() (integration style), guard BM25/full-text-search blocks with describe.skipIf(!isServerDB), and always test user-isolation. See references/db-model-test.md for 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

More from lobehub/lobe-chat

All 16
1neolabhq avatartest-skillneolabhq/context-engineering-kitUse when creating or editing skills, before deployment, to verify they work under pressure and resist rationalization - applies RED-GREEN-REFACTOR cycle to proc1.2Kskills.sh installs
2ruvnet avataragent-tdd-london-swarmruvnet/rufloAgent skill for tdd-london-swarm - invoke with $agent-tdd-london-swarm1.1Kskills.sh installs
3ruvnet avataragent-test-long-runnerruvnet/rufloAgent skill for test-long-runner - invoke with $agent-test-long-runner1.1Kskills.sh installs
4sickn33 avatartest-driven-developmentsickn33/antigravity-awesome-skillstest driven development1.1Kskills.sh installs
5cexll avatartest-casescexll/myclaudetest cases1Kskills.sh installs
6sickn33 avatartdd-workflowsickn33/antigravity-awesome-skillstdd workflow913skills.sh installs