Files
novalon-website/scripts/coverage-trend.js
T
2026-03-10 12:45:56 +08:00

27 lines
746 B
JavaScript

const fs = require('fs');
const path = require('path');
const coverageFilePath = path.join(__dirname, '..', 'coverage', 'coverage-final.json');
try {
if (!fs.existsSync(coverageFilePath)) {
console.error('Coverage file not found:', coverageFilePath);
process.exit(1);
}
const coverage = JSON.parse(fs.readFileSync(coverageFilePath, 'utf8'));
const metrics = {
statements: coverage.total.statements.pct,
branches: coverage.total.branches.pct,
functions: coverage.total.functions.pct,
lines: coverage.total.lines.pct,
timestamp: new Date().toISOString(),
};
console.log(JSON.stringify(metrics, null, 2));
} catch (error) {
console.error('Error reading coverage:', error.message);
process.exit(1);
}