Skip to content

Commit 3e4b64f

Browse files
committed
Test simple coverage report in PR
1 parent 1e72696 commit 3e4b64f

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ jobs:
3030

3131
test:
3232
runs-on: ubuntu-22.04
33+
permissions:
34+
# Required for PR comments
35+
contents: read
36+
pull-requests: write
3337

3438
steps:
3539
- uses: actions/checkout@v4
@@ -40,4 +44,20 @@ jobs:
4044

4145
- run: yarn
4246

43-
- run: yarn test:ci
47+
- run: yarn test:ci --coverage
48+
49+
# Generate PR comment with coverage
50+
- name: Coverage Report
51+
uses: davelosert/vitest-coverage-report-action@v2
52+
if: always()
53+
with:
54+
json-summary-path: ./coverage/coverage-summary.json
55+
json-final-path: ./coverage/coverage-final.json
56+
57+
# Upload artifacts if you want to view HTML locally
58+
- uses: actions/upload-artifact@v4
59+
if: always()
60+
with:
61+
name: coverage-report
62+
path: coverage/
63+
retention-days: 3

vitest.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ export default defineConfig({
1616
fileParallelism: true,
1717
coverage: {
1818
provider: "v8",
19+
reporter: ["text", "json-summary", "json", "html"],
20+
reportsDirectory: "./coverage",
21+
reportOnFailure: true,
1922
},
2023
},
2124
resolve: {

0 commit comments

Comments
 (0)