testing

Installation
Summary

Vitest testing guide for LobeHub with commands, patterns, and best practices.

  • Run specific test files with bunx vitest run commands; avoid bun run test which runs 3000+ tests (~10 minutes)
  • Prefer vi.spyOn over vi.mock for targeted, maintainable mocks; use vi.stubGlobal for browser APIs
  • Test observable behavior rather than implementation details; delete param-forwarding tests that duplicate higher-level coverage
  • Includes detailed guides for database models, Electron IPC, Zustand stores, agent runtime E2E, and desktop controllers
  • Tests must pass type check; use beforeEach/afterEach for mock cleanup and state isolation
SKILL.md

LobeHub Testing Guide

Quick Reference

Commands:

# Run specific test file
bunx vitest run --silent='passed-only' '[file-path]'

# Database package (client)
cd packages/database && bunx vitest run --silent='passed-only' '[file]'

# Database package (server)
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).

Related skills

More from lobehub/lobehub

Installs
1.0K
Repository
lobehub/lobehub
GitHub Stars
77.2K
First Seen
Jan 27, 2026