Skip to content

Commit da7e132

Browse files
committed
test: remove lcov, add json and script to parse it
1 parent d0acca1 commit da7e132

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,9 @@ jobs:
5353
- name: Test with coverage
5454
run: npm run test:coverage
5555

56-
- name: Upload coverage report
56+
- name: Coverage summary
5757
if: always()
58-
uses: actions/upload-artifact@v4
59-
with:
60-
name: coverage-report
61-
path: coverage/
62-
retention-days: 14
58+
run: bash scripts/coverage-summary.sh
6359

6460
- name: Build
6561
run: npm run build

scripts/coverage-summary.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ md="## Coverage Report
6666
6767
| File | Stmts | Branch | Funcs | Lines |
6868
|------|-------|--------|-------|-------|
69-
$(echo "$json" | jq -r '
69+
$(echo "$json" | jq -r --arg root "$(readlink -f $PWD)/" '
7070
to_entries
7171
| map(select(.key != "total"))
7272
| sort_by(.key)
7373
| .[]
74-
| "| `\(.key | ltrimstr($ENV.PWD + "/src/"))` | \(.value.statements.pct)% | \(.value.branches.pct)% | \(.value.functions.pct)% | \(.value.lines.pct)% |"
74+
| "| `\(.key | ltrimstr($root))` | \(.value.statements.pct)% | \(.value.branches.pct)% | \(.value.functions.pct)% | \(.value.lines.pct)% |"
7575
')
7676
7777
</details>

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default defineConfig({
5555
],
5656
coverage: {
5757
provider: 'v8',
58-
reporter: ['text', 'lcov'],
58+
reporter: ['text', 'json-summary'],
5959
// Files excluded from coverage entirely (untestable boilerplate,
6060
// entry points, or files covered by e2e rather than unit tests).
6161
exclude: [

0 commit comments

Comments
 (0)