feat(ci): add Codecov integration with frontend Jest coverage and CODECOV_TOKEN

Agent-Logs-Url: https://github.com/christianlouis/InboxConverge/sessions/53f8deb9-5c3a-4940-a058-c8ee7e4104e0

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-28 23:14:15 +00:00
parent 2638f415aa
commit 0645bc0462
7 changed files with 3930 additions and 6 deletions
+28 -3
View File
@@ -123,12 +123,37 @@ jobs:
cd backend
pytest tests/ -v --cov=app --cov-report=xml --cov-report=term
- name: Upload coverage to Codecov
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: '20.19.0'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install frontend dependencies
run: npm ci
working-directory: frontend
- name: Run frontend tests with coverage
run: npm run test:ci
working-directory: frontend
- name: Upload backend coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./backend/coverage.xml
flags: unittests
name: codecov-umbrella
flags: backend
name: backend-coverage
fail_ci_if_error: false
- name: Upload frontend coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./frontend/coverage/lcov.info
flags: frontend
name: frontend-coverage
fail_ci_if_error: false
# ── Phase 3: Security ──────────────────────────────────────────────────
+4
View File
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- Codecov integration: frontend Jest test coverage (lcov) and backend pytest-cov (XML) are now uploaded to Codecov with `CODECOV_TOKEN` authentication and separate `frontend`/`backend` flags.
### Fixed
- CI: replaced `safety scan --json` (requires interactive login in Safety CLI v3) with `pip-audit` to fix EOF error in the security scan job
+1
View File
@@ -4,6 +4,7 @@ Comprehensive task breakdown for repository improvements and production readines
## ✅ Recently Completed
- [x] **Codecov integration**: Added Codecov coverage reporting with `CODECOV_TOKEN` authentication. Set up Jest for frontend tests with lcov coverage, updated CI to collect and upload both backend (XML via pytest-cov) and frontend (lcov via Jest) coverage reports to Codecov with separate `backend` and `frontend` flags.
- [x] **IMAP: fix all emails appearing empty**`aioimaplib` stores RFC822 literal data as `bytearray`, not `bytes`. The extraction loop was checking `isinstance(line, bytes)` which returns `False` for `bytearray`, so every email body was silently skipped. Fixed to accept both types and convert to `bytes`. Affected T-Online, GMX, and all IMAP accounts.
- [x] **CI: fix safety scan EOF error** — replaced `safety scan --json` (Safety CLI v3 requires interactive login) with `pip-audit` (no auth required, maintained by PyPA).
- [x] **Security: upgrade fastapi/starlette and fix safety CI command** — Upgraded `fastapi` to `0.135.2` (pulls in `starlette>=1.0.0`) fixing 4 DoS CVEs in `starlette<=0.35.1`; replaced deprecated `safety check` with `safety scan`; added `.safety-policy.yml` to suppress unfixable `ecdsa` side-channel CVEs (maintainers won't fix).
+22
View File
@@ -0,0 +1,22 @@
const nextJest = require('next/jest');
const createJestConfig = nextJest({
dir: './',
});
const customJestConfig = {
testEnvironment: 'jest-environment-jsdom',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
testMatch: ['**/*.test.(ts|tsx|js|jsx)', '**/*.test.ts', '**/*.test.tsx'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
'!src/**/layout.tsx',
'!src/**/page.tsx',
'!src/instrumentation.ts',
],
};
module.exports = createJestConfig(customJestConfig);
+3869
View File
File diff suppressed because it is too large Load Diff
+6 -1
View File
@@ -6,7 +6,9 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "eslint"
"lint": "eslint",
"test": "jest",
"test:ci": "jest --coverage --coverageReporters=lcov --passWithNoTests"
},
"dependencies": {
"@tanstack/react-query": "^5.95.0",
@@ -19,11 +21,14 @@
},
"devDependencies": {
"@tailwindcss/postcss": "^4",
"@types/jest": "^30.0.0",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "16.2.1",
"jest": "^30.3.0",
"jest-environment-jsdom": "^30.3.0",
"tailwindcss": "^4",
"typescript": "^5"
}
-2
View File
@@ -1,5 +1,3 @@
import { describe, it, expect, beforeEach } from 'bun:test';
// Mock localStorage
const localStorageMock = (() => {
let store: Record<string, string> = {};