Skip to content

Commit eba1da6

Browse files
authored
feat: Add Vitest coverage reporting (#25)
1 parent 8f5c28f commit eba1da6

5 files changed

Lines changed: 184 additions & 4 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ dist-ssr
2424
*.sw?
2525

2626
# Output
27-
scripts/output/*.json
27+
scripts/output/*.json
28+
coverage/

eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tseslint from 'typescript-eslint';
66
import { defineConfig, globalIgnores } from 'eslint/config';
77

88
export default defineConfig([
9-
globalIgnores(['dist']),
9+
globalIgnores(['dist', 'coverage']),
1010
{
1111
files: ['**/*.{ts,tsx}'],
1212
extends: [

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"build": "tsc -b && vite build",
1010
"preview": "vite preview",
1111
"test": "vitest run",
12+
"test:coverage": "vitest run --coverage",
1213
"typecheck": "tsc -b",
1314
"lint": "eslint .",
1415
"format": "prettier --write .",
@@ -33,6 +34,7 @@
3334
"@types/react": "^19.2.14",
3435
"@types/react-dom": "^19.2.3",
3536
"@vitejs/plugin-react": "^6.0.1",
37+
"@vitest/coverage-v8": "^4.1.8",
3638
"cheerio": "^1.2.0",
3739
"eslint": "^10.3.0",
3840
"eslint-config-prettier": "^10.1.8",

pnpm-lock.yaml

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

vite.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,16 @@ export default defineConfig({
1515
environment: 'jsdom',
1616
setupFiles: ['./src/test/setup.ts'],
1717
passWithNoTests: true,
18+
coverage: {
19+
provider: 'v8',
20+
reporter: ['text', 'html'],
21+
exclude: [
22+
'*.config.*',
23+
'**/*.test.ts',
24+
'src/types/**',
25+
'src/test/**',
26+
'src/main.tsx',
27+
],
28+
},
1829
},
1930
});

0 commit comments

Comments
 (0)