forked from PinSpace-Org/GistPin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquality-check.sh
More file actions
executable file
路32 lines (27 loc) 路 940 Bytes
/
Copy pathquality-check.sh
File metadata and controls
executable file
路32 lines (27 loc) 路 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
set -euo pipefail
COVERAGE_FILE="Backend/coverage/coverage-summary.json"
THRESHOLDS_FILE="infrastructure/ci/coverage-thresholds.json"
if [[ ! -f "$COVERAGE_FILE" ]]; then
echo "ERROR: Coverage report not found at $COVERAGE_FILE"
exit 1
fi
node -e "
const coverage = require('./$COVERAGE_FILE');
const thresholds = require('./$THRESHOLDS_FILE');
const global = thresholds.global;
const total = coverage.total;
let failed = false;
for (const metric of ['lines', 'functions', 'branches', 'statements']) {
const pct = total[metric].pct;
const threshold = global[metric];
if (pct < threshold) {
console.error(\`FAIL: \${metric} coverage \${pct}% is below threshold \${threshold}%\`);
failed = true;
} else {
console.log(\`OK: \${metric} coverage \${pct}% >= \${threshold}%\`);
}
}
if (failed) process.exit(1);
console.log('All coverage thresholds passed.');
"