Skip to content

Commit f86fe2d

Browse files
authored
Merge pull request #1969 from codeflash-ai/fix/vitest-coverage-thresholds
Fix: Disable Vitest coverage thresholds for Codeflash-generated tests
2 parents b8c31b3 + 0ed4599 commit f86fe2d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

codeflash/languages/javascript/vitest_runner.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,21 @@ def run_vitest_behavioral_tests(
446446
# Pre-creating an empty directory may cause vitest to delete it
447447
logger.debug(f"Coverage will be written to: {coverage_dir}")
448448

449-
vitest_cmd.extend(["--coverage", "--coverage.reporter=json", f"--coverage.reportsDirectory={coverage_dir}"])
449+
vitest_cmd.extend(
450+
[
451+
"--coverage",
452+
"--coverage.reporter=json",
453+
f"--coverage.reportsDirectory={coverage_dir}",
454+
# Disable project-level coverage thresholds to prevent false failures.
455+
# Codeflash-generated tests typically cover only a single function (~1-2% of codebase),
456+
# which would fail projects with thresholds like 70% lines/functions configured
457+
# in their vitest.config.ts.
458+
"--coverage.thresholds.lines=0",
459+
"--coverage.thresholds.functions=0",
460+
"--coverage.thresholds.statements=0",
461+
"--coverage.thresholds.branches=0",
462+
]
463+
)
450464
# Note: Removed --coverage.enabled=true (redundant) and --coverage.all false
451465
# The version mismatch between vitest and @vitest/coverage-v8 can cause
452466
# issues with coverage flag parsing. Let vitest use default settings.

0 commit comments

Comments
 (0)