veza/veza-backend-api/scripts/coverage_report.sh

32 lines
1.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# coverage_report.sh — Mesure couverture par package critique (V1_SIGNOFF critère 4)
# Seuils ROADMAP : auth middleware > 80%, jwt/password > 80%, core/auth + core/marketplace > 70%, handlers > 50%, global > 55%
# Usage: ./scripts/coverage_report.sh
set -e
cd "$(dirname "$0")/.."
echo "=== Couverture Go — Packages critiques v1.0.2 ==="
echo ""
PACKAGES="./internal/middleware/... ./internal/services/... ./internal/core/auth/... ./internal/core/marketplace/... ./internal/handlers/..."
COV_OUT="coverage_v1.out"
# Run with -short to skip integration tests
go test -short -coverprofile="$COV_OUT" -covermode=atomic $PACKAGES 2>&1 || true
if [ -f "$COV_OUT" ]; then
echo ""
echo "--- Rapport par package ---"
go tool cover -func="$COV_OUT" | grep -E "internal/(middleware|services|core|handlers)" | while read line; do
echo "$line"
done
echo ""
echo "--- Total ---"
go tool cover -func="$COV_OUT" | tail -1
echo ""
echo "Rapport HTML: go tool cover -html=$COV_OUT"
else
echo "❌ Aucun fichier de couverture généré"
fi