Skip to content

Commit 70f8fdd

Browse files
committed
conf(ci): add coverage
1 parent e135e7f commit 70f8fdd

7 files changed

Lines changed: 151 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
task: [oxlint, oxfmt, build, test]
10+
task: [oxlint, oxfmt, build, test:ci]
1111
steps:
1212
- uses: actions/checkout@v4
1313

@@ -25,3 +25,10 @@ jobs:
2525
- run: mise run install --frozen-lockfile
2626

2727
- run: mise run ${{ matrix.task }}
28+
29+
- name: Upload coverage artifacts
30+
if: matrix.task == 'test:ci'
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: coverage
34+
path: coverage

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33

44
node_modules
55

6-
dist
6+
dist
7+
8+
coverage

mise.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ postinstall = "npx corepack enable"
88
experimental = true
99

1010
[tasks]
11+
"test:ci" = "pnpm test:ci"
1112
install = "pnpm install"
1213
build = "pnpm build"
1314
dev = "pnpm dev"

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,13 @@
3535
},
3636
"scripts": {
3737
"test": "vitest",
38+
"test:ci": "vitest run --coverage",
3839
"build": "tsdown",
3940
"dev": "tsdown -w"
4041
},
4142
"devDependencies": {
4243
"@types/node": "^25.0.10",
44+
"@vitest/coverage-v8": "4.0.18",
4345
"@vue/devtools-api": "^8.0.5",
4446
"oxfmt": "^0.27.0",
4547
"oxlint": "^1.42.0",

pnpm-lock.yaml

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

tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
"types": ["node"],
1212
"declaration": true,
1313
"emitDeclarationOnly": true,
14-
"outDir": "dist",
15-
"rootDir": "./src"
14+
"outDir": "dist"
1615
},
17-
"include": ["src"],
16+
"include": [
17+
"src",
18+
"vitest.config.ts",
19+
"tsdown.config.ts"
20+
],
1821
"exclude": ["demo"]
1922
}

vitest.config.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import { defineConfig } from 'vitest/config'
22

33
export default defineConfig({
4-
test: { include: ['src/**/*.test.ts'] },
4+
test: {
5+
include: ['src/**/*.test.ts'],
6+
reporters: process.env.GITHUB_ACTIONS
7+
? ['dot', 'github-actions']
8+
: ['dot'],
9+
},
510
})

0 commit comments

Comments
 (0)