From ed4acabc0c90ef4a832a97f2db73bec8865d63fb Mon Sep 17 00:00:00 2001 From: Eric Pinzur <2641606+epinzur@users.noreply.github.com> Date: Wed, 30 Jul 2025 07:11:27 +0200 Subject: [PATCH] bug: fix frontend code coverage scoring (#9209) fix frontend code coverage scoring --- codecov.yml | 22 +++++++++------------- src/frontend/jest.config.js | 19 ++++++++++--------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/codecov.yml b/codecov.yml index 749523966..9c8faf593 100644 --- a/codecov.yml +++ b/codecov.yml @@ -12,11 +12,6 @@ coverage: status: project: - # Overall project coverage target - default: - target: 60% - threshold: 3% - # Backend coverage strategy: Aspirational target for progress tracking # Current coverage: ~33%, Target: 55% (intentionally higher than current) # This creates visual progress indicators (red->yellow->green) without blocking PRs @@ -31,21 +26,22 @@ coverage: - backend # Frontend coverage: Realistic target based on current state - # Current coverage: ~70%, maintains existing high standards + # Current coverage: ~1.5%, Target: 10% (achievable improvement goal) frontend: - target: 70% + target: 10% # Threshold: Allowable drop in coverage before failing the check - # 2% = coverage can drop from 70% to 68% without failing status - # Stricter threshold to maintain established quality standards - threshold: 2% + # 1% = coverage can drop from 1.5% to 0.5% without failing status + # Small threshold appropriate for very low baseline coverage + threshold: 1% flags: - frontend - # New code coverage requirements - encourages well-tested new features + # New code coverage requirements - realistic target for current state + # Encourages testing new features without blocking development patch: default: - target: 70% - threshold: 3% + target: 40% + threshold: 5% # PR comment configuration - what information to show in coverage reports comment: diff --git a/src/frontend/jest.config.js b/src/frontend/jest.config.js index 720b5f828..7eabf0685 100644 --- a/src/frontend/jest.config.js +++ b/src/frontend/jest.config.js @@ -19,18 +19,19 @@ module.exports = { transformIgnorePatterns: ["node_modules/(?!(.*\\.mjs$|@testing-library))"], // Coverage configuration - collectCoverage: process.env.CI === "true", + collectCoverage: true, + collectCoverageFrom: [ + "src/**/*.{ts,tsx}", + "!src/**/*.{test,spec}.{ts,tsx}", + "!src/**/tests/**", + "!src/**/__tests__/**", + "!src/setupTests.ts", + "!src/vite-env.d.ts", + "!src/**/*.d.ts", + ], coverageDirectory: "coverage", coverageReporters: ["text", "lcov", "html", "json-summary"], coveragePathIgnorePatterns: ["/node_modules/", "/tests/"], - coverageThreshold: { - global: { - branches: 50, - functions: 50, - lines: 50, - statements: 50, - }, - }, // CI-specific configuration ...(process.env.CI === "true" && {