# Makefile for Homelab Automation Dashboard - Test Commands # ========================================================== .PHONY: help test test-backend test-frontend test-all test-cov install-test-deps lint # Default target help: @echo "Homelab Automation Dashboard - Test Commands" @echo "=============================================" @echo "" @echo "Usage: make " @echo "" @echo "Targets:" @echo " install-test-deps Install all test dependencies (Python + Node.js)" @echo " test-backend Run backend Python tests" @echo " test-frontend Run frontend JavaScript tests" @echo " test-all Run all tests (backend + frontend)" @echo " test-cov Run all tests with coverage reports" @echo " test-watch Run tests in watch mode" @echo " lint Run linters (if configured)" @echo "" # Install test dependencies install-test-deps: @echo "Installing Python test dependencies..." pip install pytest pytest-asyncio pytest-cov httpx respx freezegun pytest-mock @echo "" @echo "Installing Node.js test dependencies..." npm install @echo "" @echo "✅ All test dependencies installed" # Backend tests only test-backend: @echo "Running backend tests..." pytest tests/backend -v --tb=short -m "unit" # Backend tests with coverage test-backend-cov: @echo "Running backend tests with coverage..." pytest tests/backend -v --tb=short --cov=app --cov-report=html --cov-report=term-missing # Frontend tests only test-frontend: @echo "Running frontend tests..." npm test # Frontend tests with coverage test-frontend-cov: @echo "Running frontend tests with coverage..." npm run test:coverage # All tests test-all: test-backend test-frontend @echo "" @echo "✅ All tests completed" # All tests with coverage test-cov: test-backend-cov test-frontend-cov @echo "" @echo "✅ All tests completed with coverage" @echo "Backend coverage: htmlcov/index.html" @echo "Frontend coverage: coverage/index.html" # Watch mode (frontend only - uses Vitest watch) test-watch: npm run test:watch # Quick test (fast subset) test-quick: pytest tests/backend -v --tb=short -m "unit" -x -q npm test -- --run # Integration tests test-integration: pytest tests/backend -v --tb=short -m "integration" # Clean test artifacts clean-test: @echo "Cleaning test artifacts..." rm -rf .pytest_cache __pycache__ htmlcov coverage .coverage rm -rf tests/backend/__pycache__ tests/frontend/__pycache__ @echo "✅ Test artifacts cleaned"