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:
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
|||||||
run: pip install -r backend/requirements.txt -r backend/requirements-dev.txt
|
run: pip install -r backend/requirements.txt -r backend/requirements-dev.txt
|
||||||
|
|
||||||
- name: Run tests with coverage
|
- 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
|
- name: Display coverage summary
|
||||||
if: always()
|
if: always()
|
||||||
@@ -89,8 +89,8 @@ jobs:
|
|||||||
- name: Lint
|
- name: Lint
|
||||||
run: cd frontend && npm run lint
|
run: cd frontend && npm run lint
|
||||||
|
|
||||||
- name: Test
|
- name: Test with coverage
|
||||||
run: cd frontend && npm test
|
run: cd frontend && npm run test:coverage
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cd frontend && npm run build
|
run: cd frontend && npm run build
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -219,6 +219,7 @@ frontend/stats.html
|
|||||||
frontend/playwright-report/
|
frontend/playwright-report/
|
||||||
frontend/test-results/
|
frontend/test-results/
|
||||||
frontend/e2e/.auth/
|
frontend/e2e/.auth/
|
||||||
|
frontend/coverage/
|
||||||
|
|
||||||
# Superpowers brainstorming mockups
|
# Superpowers brainstorming mockups
|
||||||
.superpowers/
|
.superpowers/
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
|
"test:coverage": "vitest run --coverage",
|
||||||
"test:watch": "vitest",
|
"test:watch": "vitest",
|
||||||
"test:e2e": "playwright test",
|
"test:e2e": "playwright test",
|
||||||
"test:e2e:headed": "playwright test --headed",
|
"test:e2e:headed": "playwright test --headed",
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
"recharts": "^3.7.0",
|
"recharts": "^3.7.0",
|
||||||
"sonner": "^2.0.7",
|
"sonner": "^2.0.7",
|
||||||
"tailwind-merge": "^3.4.0",
|
"tailwind-merge": "^3.4.0",
|
||||||
|
"web-vitals": "^4.2.4",
|
||||||
"zundo": "^2.3.0",
|
"zundo": "^2.3.0",
|
||||||
"zustand": "^5.0.10"
|
"zustand": "^5.0.10"
|
||||||
},
|
},
|
||||||
@@ -60,6 +62,7 @@
|
|||||||
"@types/node": "^24.10.9",
|
"@types/node": "^24.10.9",
|
||||||
"@types/react": "^19.2.5",
|
"@types/react": "^19.2.5",
|
||||||
"@types/react-dom": "^19.2.3",
|
"@types/react-dom": "^19.2.3",
|
||||||
|
"@vitest/coverage-v8": "^4.0.18",
|
||||||
"@vitejs/plugin-react": "^5.1.1",
|
"@vitejs/plugin-react": "^5.1.1",
|
||||||
"eslint": "^9.39.1",
|
"eslint": "^9.39.1",
|
||||||
"eslint-plugin-react-hooks": "^7.0.1",
|
"eslint-plugin-react-hooks": "^7.0.1",
|
||||||
|
|||||||
@@ -33,6 +33,18 @@ export default defineConfig({
|
|||||||
environment: 'jsdom',
|
environment: 'jsdom',
|
||||||
setupFiles: './src/test/setup.ts',
|
setupFiles: './src/test/setup.ts',
|
||||||
include: ['src/**/*.{test,spec}.{ts,tsx}'],
|
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: {
|
build: {
|
||||||
sourcemap: 'hidden', // Generate source maps but don't expose them publicly
|
sourcemap: 'hidden', // Generate source maps but don't expose them publicly
|
||||||
|
|||||||
Reference in New Issue
Block a user