117 lines
2.6 KiB
Bash
Executable File
117 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Comprehensive test script
|
|
# Runs all tests: unit, E2E, hydration, emails, etc.
|
|
|
|
set -e # Exit on error
|
|
|
|
echo "🧪 Running comprehensive test suite..."
|
|
echo ""
|
|
|
|
# Colors for output
|
|
GREEN='\033[0;32m'
|
|
RED='\033[0;31m'
|
|
YELLOW='\033[1;33m'
|
|
NC='\033[0m' # No Color
|
|
|
|
# Track failures
|
|
FAILED=0
|
|
|
|
# 1. TypeScript check
|
|
echo "📝 Checking TypeScript..."
|
|
if npx tsc --noEmit; then
|
|
echo -e "${GREEN}✅ TypeScript check passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ TypeScript check failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 2. Lint check
|
|
echo "🔍 Running ESLint..."
|
|
if npm run lint; then
|
|
echo -e "${GREEN}✅ Lint check passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Lint check failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 3. Build check
|
|
echo "🏗️ Building application..."
|
|
if npm run build; then
|
|
echo -e "${GREEN}✅ Build check passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Build check failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 4. Unit tests
|
|
echo "🧪 Running unit tests..."
|
|
if npm run test; then
|
|
echo -e "${GREEN}✅ Unit tests passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Unit tests failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 5. E2E tests (critical paths)
|
|
echo "🌐 Running E2E tests (critical paths)..."
|
|
if npm run test:critical; then
|
|
echo -e "${GREEN}✅ Critical paths tests passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Critical paths tests failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 6. Hydration tests
|
|
echo "💧 Running hydration tests..."
|
|
if npm run test:hydration; then
|
|
echo -e "${GREEN}✅ Hydration tests passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Hydration tests failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 7. Email tests
|
|
echo "📧 Running email tests..."
|
|
if npm run test:email; then
|
|
echo -e "${GREEN}✅ Email tests passed${NC}"
|
|
else
|
|
echo -e "${RED}❌ Email tests failed${NC}"
|
|
FAILED=1
|
|
fi
|
|
echo ""
|
|
|
|
# 8. Performance tests
|
|
echo "⚡ Running performance tests..."
|
|
if npm run test:performance; then
|
|
echo -e "${GREEN}✅ Performance tests passed${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠️ Performance tests had issues (non-critical)${NC}"
|
|
fi
|
|
echo ""
|
|
|
|
# 9. Accessibility tests
|
|
echo "♿ Running accessibility tests..."
|
|
if npm run test:accessibility; then
|
|
echo -e "${GREEN}✅ Accessibility tests passed${NC}"
|
|
else
|
|
echo -e "${YELLOW}⚠️ Accessibility tests had issues (non-critical)${NC}"
|
|
fi
|
|
echo ""
|
|
|
|
# Summary
|
|
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
|
if [ $FAILED -eq 0 ]; then
|
|
echo -e "${GREEN}🎉 All critical tests passed!${NC}"
|
|
exit 0
|
|
else
|
|
echo -e "${RED}❌ Some tests failed. Please review the output above.${NC}"
|
|
exit 1
|
|
fi
|