Skip to content

Commit aa0d47b

Browse files
fix: improve Codecov coverage reporting configuration
Changes: 1. CI workflows now generate coverage with --coverage flag 2. Added explicit coverage file path (./coverage/lcov.info) 3. Added coverage metadata (flags, name) for better tracking 4. Enhanced Jest config with coverage configuration: - Collect coverage from src/**/*.js - Exclude test files and node_modules - Generate lcov and html reports - Set 70% coverage thresholds This resolves the 'No coverage reports found' error in CI
1 parent 5aabf54 commit aa0d47b

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

.github/workflows/ci-enhanced.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ jobs:
9595
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
9696
with:
9797
token: ${{ secrets.CODECOV_TOKEN }}
98+
files: ./coverage/lcov.info
99+
flags: unittests
100+
name: codecov-umbrella
98101
fail_ci_if_error: false
99102
continue-on-error: true
100103

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: npm run lint --if-present
5353

5454
- name: Test
55-
run: npm test -- --ci --passWithNoTests
55+
run: npm test -- --ci --coverage --passWithNoTests
5656

5757
- name: Audit (non-blocking)
5858
run: npm audit --audit-level=moderate || echo "::warning::audit issues found"
@@ -67,5 +67,8 @@ jobs:
6767
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
6868
with:
6969
token: ${{ secrets.CODECOV_TOKEN }}
70+
files: ./coverage/lcov.info
71+
flags: unittests
72+
name: codecov-umbrella
7073
fail_ci_if_error: false
7174
continue-on-error: true

jest.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,22 @@ module.exports = {
1414
// transform ESM deps like inquirer to CJS so require() won't crash
1515
transform: { "^.+\\.js$": "babel-jest" },
1616
transformIgnorePatterns: ["node_modules/(?!(inquirer)/)"],
17+
// Coverage configuration
18+
collectCoverageFrom: [
19+
"src/**/*.js",
20+
"!src/**/*.test.js",
21+
"!src/**/*.spec.js",
22+
"!**/node_modules/**",
23+
"!**/__tests__/**",
24+
],
25+
coverageReporters: ["text", "lcov", "html"],
26+
coverageDirectory: "coverage",
27+
coverageThreshold: {
28+
global: {
29+
branches: 70,
30+
functions: 70,
31+
lines: 70,
32+
statements: 70,
33+
},
34+
},
1735
};

0 commit comments

Comments
 (0)