♻️ refactor: use simple coverage file approach for BDD tests (KISS principle)
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 9s
CI/CD Pipeline / CI Pipeline (push) Successful in 4m48s

This commit is contained in:
2026-04-08 13:56:29 +02:00
parent f47094cbba
commit cc9c2a5674
2 changed files with 7 additions and 10 deletions

View File

@@ -194,16 +194,13 @@ jobs:
export DLC_DATABASE_PASSWORD=postgres export DLC_DATABASE_PASSWORD=postgres
export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test export DLC_DATABASE_NAME=dance_lessons_coach_bdd_test
export DLC_DATABASE_SSL_MODE=disable export DLC_DATABASE_SSL_MODE=disable
# Run BDD tests and capture output ./scripts/run-bdd-tests.sh
test_output=$(./scripts/run-bdd-tests.sh 2>&1)
echo "$test_output"
# Extract BDD coverage percentage directly from test output # Generate BDD coverage report
BDD_COVERAGE=$(echo "$test_output" | grep "coverage:" | grep -oP '\d+\.\d+' | head -1) go tool cover -func=coverage.out > bdd_coverage.txt
if [ -z "$BDD_COVERAGE" ]; then
echo "ERROR: Could not extract BDD coverage from test output" # Extract BDD coverage percentage
exit 1 BDD_COVERAGE=$(grep "total:" bdd_coverage.txt | grep -oP '\d+\.\d+' | head -1)
fi
echo "BDD Coverage: ${BDD_COVERAGE}%" echo "BDD Coverage: ${BDD_COVERAGE}%"
# Update BDD coverage badge # Update BDD coverage badge

View File

@@ -95,7 +95,7 @@ else
fi fi
# Run tests with proper coverage measurement # Run tests with proper coverage measurement
test_output=$(go test ./features/... -v -cover -coverpkg=./... 2>&1) test_output=$(go test ./features/... -v -cover -coverpkg=./... -coverprofile=coverage.out 2>&1)
test_exit_code=$? test_exit_code=$?
echo "$test_output" echo "$test_output"