Current State
No test files (.test.* or .spec.*) exist in the monorepo. The project focuses on:
- Type safety via TypeScript
- Runtime validation via Zod schemas
- Code quality via Oxlint and Oxfmt
- Pre-commit validation via Lefthook
Recommended Testing Setup
When you’re ready to add tests, here’s the recommended approach for ZeroStarter’s tech stack.Testing Framework
Use Bun’s built-in test runner - it’s fast, has zero configuration, and integrates perfectly with the existing Bun setup. Why Bun test?- Built into Bun (already installed)
- No additional dependencies
- Jest-compatible API
- Native TypeScript support
- Extremely fast execution
- Built-in code coverage
Installation
No installation needed! Bun’s test runner is built-in.Basic Test Structure
Create test files alongside your source code:Example: Unit Test
Example: API Test (Hono)
Example: Database Test (Drizzle)
Example: React Component Test
For Next.js components, use React Testing Library with Bun:Running Tests
Run all tests
Watch mode
Run specific test file
Code coverage
Workspace-Specific Testing
Add test scripts to workspacepackage.json files:
Hono API (api/hono/package.json)
Next.js Web (web/next/package.json)
Root package.json
Testing Patterns
1. Test Environment Variables
Create a test environment config:bunfig.toml:
2. Mock Database for Tests
Use a separate test database:3. API Testing Best Practices
4. Testing Zod Schemas
Integration with Code Quality Tools
Add test to pre-commit hook
Updatelefthook.yml:
Add test to CI/CD
Testing Resources
Official Documentation
- Bun Test Runner - Official Bun testing docs
- React Testing Library - Component testing
- Testing Best Practices - By Kent C. Dodds
Recommended Libraries
Next Steps
- Start small - Add tests for critical business logic first
- Test user flows - Focus on what users actually do
- Avoid testing implementation details - Test behavior, not internals
- Maintain fast tests - Keep test suite under 10 seconds
- Use factories - Create test data builders for common objects
- Mock external services - Don’t call real APIs in tests