Skip to content

Commit 0dcc5f8

Browse files
committed
Test simple coverage report in PR
1 parent 1e72696 commit 0dcc5f8

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ jobs:
3131
test:
3232
runs-on: ubuntu-22.04
3333

34+
permissions:
35+
contents: read
36+
pull-requests: write
37+
checks: write
38+
3439
steps:
3540
- uses: actions/checkout@v4
3641

@@ -40,4 +45,21 @@ jobs:
4045

4146
- run: yarn
4247

43-
- run: yarn test:ci
48+
- run: yarn test:ci --coverage
49+
50+
- name: Coverage Report
51+
uses: davelosert/vitest-coverage-report-action@v2
52+
if: |
53+
always() &&
54+
github.event_name == 'pull_request'
55+
with:
56+
json-summary-path: ./coverage/coverage-summary.json
57+
json-final-path: ./coverage/coverage-final.json
58+
59+
# Always upload artifacts for manual inspection
60+
- uses: actions/upload-artifact@v4
61+
if: always()
62+
with:
63+
name: coverage-report
64+
path: coverage/
65+
retention-days: 1

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)