Spaces:
Configuration error
Configuration error
Download scripts/check-coverage.mjs from pirzm1/video-generator: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/pirzm1/video-generator/resolve/main/scripts/check-coverage.mjs
- Command line
-
hf download hf://spaces/pirzm1/video-generator/scripts/check-coverage.mjs
-
curl -L -o check-coverage.mjs https://huggingface.co/spaces/pirzm1/video-generator/resolve/main/scripts/check-coverage.mjs
1.46 kB
| // CI coverage gate: fails if V8 line coverage (from `node --test | |
| // --experimental-test-coverage`) drops below a seeded floor. Run the coverage | |
| // command, pipe its TAP/table to this script's stdin. | |
| // | |
| // Usage: npm run test:coverage | node scripts/check-coverage.mjs | |
| // (or: node --test --experimental-test-coverage ... | node scripts/check-coverage.mjs) | |
| // | |
| // The "all files | line% | branch% | funcs%" summary row is parsed; the line | |
| // percentage is compared against MIN_LINE_COVERAGE (default 80). Keeping the | |
| // floor slightly below the current ~82% means a genuine regression (not | |
| // harmless refactors) turns CI red, satisfying the empirical-proof bar that | |
| // production changes must not silently erode coverage. | |
| import { readFileSync } from 'node:fs'; | |
| const input = readFileSync(0, 'utf8'); | |
| const floor = Number(process.env.MIN_LINE_COVERAGE ?? '80'); | |
| const row = input.match(/all files\s*\|\s*([\d.]+)\s*\|\s*([\d.]+)\s*\|\s*([\d.]+)/i); | |
| if (!row) { | |
| console.error('check-coverage: could not find "all files" coverage summary row'); | |
| process.exit(1); | |
| } | |
| const linePct = Number(row[1]); | |
| const branchPct = Number(row[2]); | |
| const funcPct = Number(row[3]); | |
| console.log(`coverage: lines=${linePct}% branch=${branchPct}% funcs=${funcPct}% (floor=${floor}%)`); | |
| if (linePct < floor) { | |
| console.error(`check-coverage: LINE coverage ${linePct}% is below floor ${floor}% — failing CI`); | |
| process.exit(1); | |
| } | |
| console.log('check-coverage: OK'); | |