## Problem
When Codeflash runs Vitest tests, coverage files are not collected even
though tests run successfully. This affects 14 out of ~20 optimization
runs, resulting in 0% coverage reported.
Root cause: The generated `codeflash.vitest.config.mjs` only overrides
`include`, `pool`, and `setupFiles`, but does NOT override coverage
settings. When the project's vitest.config.ts has custom coverage
settings (e.g., `reporter: ["text", "lcov"]`), Vitest's `mergeConfig()`
doesn't properly handle the nested coverage object merge with command-line
flags like `--coverage.reporter=json`, resulting in coverage files not
being written to the expected location.
## Solution
Explicitly override `coverage.reporter` to `['json']` in the generated
codeflash.vitest.config.mjs file. This ensures consistent behavior
regardless of Vitest version or project configuration.
## Testing
Added comprehensive unit tests in test_vitest_coverage_config.py that:
1. Verify coverage overrides are present in generated config
2. Test with and without existing project coverage settings
3. Confirm generated config includes expected coverage.reporter
All tests pass ✓
## References
- Trace IDs affected: 11f707d6, 69b271f5, and 12 others
- Related to iteration 2 investigation in fix_history.log
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>