|
11 | 11 | MIN_TESTCASE_PASSED_THRESHOLD, |
12 | 12 | MIN_THROUGHPUT_IMPROVEMENT_THRESHOLD, |
13 | 13 | ) |
| 14 | +from codeflash.models.models import CoverageStatus |
14 | 15 | from codeflash.models.test_type import TestType |
15 | 16 |
|
16 | 17 | if TYPE_CHECKING: |
@@ -206,14 +207,17 @@ def quantity_of_tests_critic(candidate_result: OptimizedCandidateResult | Origin |
206 | 207 | def coverage_critic(original_code_coverage: CoverageData | None) -> bool: |
207 | 208 | """Check if the coverage meets the threshold. |
208 | 209 |
|
209 | | - For languages without coverage support (like JavaScript), returns True if no coverage data is available. |
210 | | - Java now uses JaCoCo for coverage collection and is subject to coverage threshold checks. |
| 210 | + Returns True when: |
| 211 | + - Coverage data exists, was parsed successfully, and meets the threshold, OR |
| 212 | + - No coverage data is available (skip the check for languages/projects without coverage support), OR |
| 213 | + - Coverage data exists but was NOT_FOUND (e.g., JaCoCo report not generated in multi-module projects) |
211 | 214 | """ |
212 | | - from codeflash.languages import is_javascript |
213 | | - |
214 | 215 | if original_code_coverage: |
| 216 | + # If coverage data was not found (e.g., JaCoCo report doesn't exist in multi-module projects), |
| 217 | + # skip the coverage check instead of failing with 0% coverage |
| 218 | + if original_code_coverage.status == CoverageStatus.NOT_FOUND: |
| 219 | + return True |
215 | 220 | return original_code_coverage.coverage >= COVERAGE_THRESHOLD |
216 | | - # For JavaScript, coverage is not implemented yet, so skip the check |
217 | | - if is_javascript(): |
218 | | - return True |
219 | | - return False |
| 221 | + # When no coverage data is available (e.g., JavaScript, Java multi-module projects), |
| 222 | + # skip the coverage check and allow optimization to proceed |
| 223 | + return True |
0 commit comments