Agent skill · operations · lobehub
testing
Use for Vitest tests, mocks, coverage and failing-test diagnosis.
Why this skill is useful
Provides specific commands and patterns for Vitest testing that the AI wouldn't reliably generate on its own.
What it needs
Requires bun installed locally. About 3k tokens when loaded. Last updated 2026-08-07. 81,352 stars on the source repository.
What this skill does
LobeHub Testing Guide Quick Reference Commands: 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 Category Location Config -------- --------------------------- ------------------------------- Webapp src//.test.ts(x) vitest.config.ts Packages packages///.test.ts packages//vitest.config.ts Desktop apps/desktop//.test.ts apps/desktop/vitest.config.ts Core Principles 1. Prefer vi.spyOn over vi.mock - More targeted, easier to maintain. The root Vitest configs do not restore mocks automatically; restore spies in test cleanup with vi.restoreAllMocks(). 2. Test behavior, not implementation details Keep native node:test CI checks under .github/scripts/, outside the app Vitest discovery paths. When mixing test runners, verify both the intended runner and the owning Vitest project's file discovery before pushing. 3. Regression tests for bug fixes - Include a regression test that fails without the fix and passes with it; write the failing test first when the failure is easy to reproduce. Skip pure style/CSS fixes (selector, hover, mask, spacing, color) when the only practical assertion would be source-string matching on the stylesheet — that is not a regression test worth shipping. 4. No new component tests - Only update existing React component tests. Complex logic should be extracted into hooks and tested there instead UI Library Mocks (@lobehub/ui/base-ui) Default: do NOT mock @lobehub/ui/base-ui — render the real components. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills lobehub/testing--030480