Skip to content

Commit 78fc295

Browse files
committed
fix: test coverage output fix
1 parent 60b2f16 commit 78fc295

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,18 @@ jobs:
7979
console.log(coverage.total.statements.pct + '%');
8080
")
8181
82-
echo "| File | Statements | Branches | Functions | Lines |" >> $GITHUB_STEP_SUMMARY
83-
echo "|------|------------|----------|-----------|-------|" >> $GITHUB_STEP_SUMMARY
82+
echo "| Metric | Coverage |" >> $GITHUB_STEP_SUMMARY
83+
echo "|--------|----------|" >> $GITHUB_STEP_SUMMARY
8484
85-
# Add overall coverage
85+
# Add overall coverage summary
8686
node -e "
8787
const fs = require('fs');
8888
const coverage = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
8989
const total = coverage.total;
90-
console.log(\`| **Overall** | \${total.statements.pct}% | \${total.branches.pct}% | \${total.functions.pct}% | \${total.lines.pct}% |\`);
91-
" >> $GITHUB_STEP_SUMMARY
92-
93-
# Add individual file coverage
94-
node -e "
95-
const fs = require('fs');
96-
const coverage = JSON.parse(fs.readFileSync('coverage/coverage-summary.json', 'utf8'));
97-
Object.keys(coverage).forEach(file => {
98-
if (file !== 'total' && file.includes('src/') && !file.includes('__tests__')) {
99-
const filename = file.split('/').pop();
100-
const fileCov = coverage[file];
101-
console.log(\`| \${filename} | \${fileCov.statements.pct}% | \${fileCov.branches.pct}% | \${fileCov.functions.pct}% | \${fileCov.lines.pct}% |\`);
102-
}
103-
});
90+
console.log(\`| **Statements** | \${total.statements.pct}% (\${total.statements.covered}/\${total.statements.total}) |\`);
91+
console.log(\`| **Branches** | \${total.branches.pct}% (\${total.branches.covered}/\${total.branches.total}) |\`);
92+
console.log(\`| **Functions** | \${total.functions.pct}% (\${total.functions.covered}/\${total.functions.total}) |\`);
93+
console.log(\`| **Lines** | \${total.lines.pct}% (\${total.lines.covered}/\${total.lines.total}) |\`);
10494
" >> $GITHUB_STEP_SUMMARY
10595
else
10696
OVERALL_COVERAGE="N/A"

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default defineConfig({
66
environment: "node",
77
coverage: {
88
provider: "v8",
9-
reporter: ["text", "json", "html", "lcov"],
9+
reporter: ["text", "json", "json-summary", "html", "lcov"],
1010
exclude: [
1111
"node_modules/",
1212
"dist/",

0 commit comments

Comments
 (0)