name: run-tests description: Run and verify tests for the DNA project. Use when making code changes, running tests, checking coverage, or when the user asks to test changes. Covers both backend (pytest via Docker) and frontend (Vitest) testing workflows.
Run Tests
Quick Reference
| Component | Command | Working Directory |
|---|---|---|
| Backend | make test |
backend/ |
| Frontend (all) | npm run test-ci |
frontend/ |
| Frontend (watch) | npm run test |
frontend/ |
Backend Testing
Backend uses pytest with pytest-cov, running inside Docker.
cd backend
make test
Coverage Commands
make test-cov # Run with coverage
make test-cov-html # Generate HTML coverage report (htmlcov/index.html)
Coverage Requirement
Backend tests must maintain at least 90% coverage.
After Backend Changes
Always run make format-python after making backend changes:
cd backend
make format-python
Frontend Testing
Frontend uses Vitest for both @dna/core and @dna/app packages.
Run All Tests
cd frontend
npm run test-ci # Single run, no watch (preferred for verification)
npm run test # Watch mode (for development)
Run with Coverage
npm run test:coverage
Run Specific Package
npm run test --workspace=@dna/core
npm run test --workspace=@dna/app
Test File Conventions
| Component | Pattern | Location |
|---|---|---|
| Backend | test_*.py |
backend/tests/ |
| Frontend | *.test.ts or *.test.tsx |
Alongside source or in __tests__/ |
Workflow
When making changes:
- Make your code changes
- Run the appropriate tests:
- Backend changes:
make testfrombackend/ - Frontend changes:
npm run test-cifromfrontend/
- Backend changes:
- Fix any failing tests
- For backend: run
make format-python - Verify coverage meets requirements (90% for backend)