Skip to content

Commit 79b376d

Browse files
committed
ci: add test coverage reporting with vitest/coverage-v8 and codecov
1 parent 1c58f26 commit 79b376d

File tree

4 files changed

+201
-17
lines changed

4 files changed

+201
-17
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,13 @@ jobs:
5858
- name: Run lint
5959
run: npm run lint
6060

61-
- name: Run tests
62-
run: npm run test:run
61+
- name: Run tests with coverage
62+
run: npm run test:coverage
63+
64+
- name: Upload coverage reports
65+
uses: codecov/codecov-action@v4
66+
with:
67+
files: ./coverage/coverage-final.json
68+
fail_ci_if_error: false
69+
env:
70+
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

package-lock.json

Lines changed: 188 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"dev": "tsup --watch",
3939
"test": "vitest",
4040
"test:run": "vitest run",
41+
"test:coverage": "vitest run --coverage",
4142
"lint": "eslint src/",
4243
"typecheck": "tsc --noEmit",
4344
"prepublishOnly": "npm run build"
@@ -70,6 +71,7 @@
7071
"@napi-rs/cli": "^3.5.1",
7172
"@opencode-ai/plugin": "^1.1.21",
7273
"@types/node": "^25.0.8",
74+
"@vitest/coverage-v8": "^4.0.17",
7375
"eslint": "^9.0.0",
7476
"tsup": "^8.1.0",
7577
"typescript": "^5.5.0",

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default defineConfig({
77
include: ["tests/**/*.test.ts"],
88
coverage: {
99
provider: "v8",
10-
reporter: ["text", "html"],
10+
reporter: ["text", "html", "json"],
1111
include: ["src/**/*.ts"],
1212
exclude: ["src/native/index.ts"],
1313
},

0 commit comments

Comments
 (0)