ci: enforce 80% backend coverage gate and add frontend coverage reporting

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-18 02:41:00 +00:00
parent 2f18056fd1
commit b1d1aef702
4 changed files with 19 additions and 3 deletions

View File

@@ -48,7 +48,7 @@ jobs:
run: pip install -r backend/requirements.txt -r backend/requirements-dev.txt
- name: Run tests with coverage
run: cd backend && python -m pytest --override-ini="addopts=" --cov=app --cov-report=term-missing --cov-report=json:coverage.json
run: cd backend && python -m pytest --override-ini="addopts=" --cov=app --cov-report=term-missing --cov-report=json:coverage.json --cov-fail-under=80
- name: Display coverage summary
if: always()
@@ -89,8 +89,8 @@ jobs:
- name: Lint
run: cd frontend && npm run lint
- name: Test
run: cd frontend && npm test
- name: Test with coverage
run: cd frontend && npm run test:coverage
- name: Build
run: cd frontend && npm run build

1
.gitignore vendored
View File

@@ -219,6 +219,7 @@ frontend/stats.html
frontend/playwright-report/
frontend/test-results/
frontend/e2e/.auth/
frontend/coverage/
# Superpowers brainstorming mockups
.superpowers/

View File

@@ -12,6 +12,7 @@
"lint": "eslint .",
"preview": "vite preview",
"test": "vitest run",
"test:coverage": "vitest run --coverage",
"test:watch": "vitest",
"test:e2e": "playwright test",
"test:e2e:headed": "playwright test --headed",
@@ -48,6 +49,7 @@
"recharts": "^3.7.0",
"sonner": "^2.0.7",
"tailwind-merge": "^3.4.0",
"web-vitals": "^4.2.4",
"zundo": "^2.3.0",
"zustand": "^5.0.10"
},
@@ -60,6 +62,7 @@
"@types/node": "^24.10.9",
"@types/react": "^19.2.5",
"@types/react-dom": "^19.2.3",
"@vitest/coverage-v8": "^4.0.18",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.0.1",

View File

@@ -33,6 +33,18 @@ export default defineConfig({
environment: 'jsdom',
setupFiles: './src/test/setup.ts',
include: ['src/**/*.{test,spec}.{ts,tsx}'],
coverage: {
provider: 'v8',
reporter: ['text', 'json-summary', 'html'],
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/test/**',
'src/types/**',
'src/**/*.d.ts',
'src/instrument.ts',
'src/main.tsx',
],
},
},
build: {
sourcemap: 'hidden', // Generate source maps but don't expose them publicly