fix(frontend): report coverage from the browser-mode tests - #7586
fix(frontend): report coverage from the browser-mode tests#7586aglinxinyuan wants to merge 2 commits into
Conversation
The browser-mode suite runs in CI and uploads its JUnit results, but never its coverage, so every line it exercises is reported as untested. For code-editor.component.ts that is 67 of the 115 lines Codecov calls uncovered - measured by intersecting the two lcov records - and merging them takes the file from 49.8% to 79.0% without writing a test. Passing --coverage alone is not enough: the run fails with "Failed to fetch dynamically imported module: /@id/@vitest/coverage-v8/browser", because the coverage provider is loaded dynamically and is not in the import graph that Vite's scan crawls. The tests still pass while the coverage step errors, which is why this went unnoticed. Adding it to optimizeDeps.include alongside buffer fixes it. Browser coverage is written to coverage-browser/ so it does not overwrite the jsdom run's coverage/gui/lcov.info, and both are uploaded under the frontend flag, which Codecov merges.
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7586 +/- ##
============================================
+ Coverage 88.63% 88.85% +0.21%
+ Complexity 4346 4344 -2
============================================
Files 1177 1177
Lines 46894 46943 +49
Branches 5229 5231 +2
============================================
+ Hits 41566 41709 +143
+ Misses 3568 3486 -82
+ Partials 1760 1748 -12
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| config | throughput | MB/s | latency | max Δ latest / 7d | |
|---|---|---|---|---|---|
| 🔴 | bs=10 sw=10 sl=64 | 329 | 0.201 | 27,839/47,105/47,105 us | 🔴 +37.2% / 🔴 +194.6% |
| 🔴 | bs=100 sw=10 sl=64 | 786 | 0.48 | 123,305/162,167/162,167 us | 🔴 +5.3% / 🔴 +50.1% |
| ⚪ | bs=1000 sw=10 sl=64 | 904 | 0.552 | 1,104,813/1,192,488/1,192,488 us | ⚪ within ±5% / 🔴 +14.8% |
Baseline details
Latest main 5021bc6 from same runner
| config | metric | PR | latest main | 7d avg | Δ latest | Δ 7d |
|---|---|---|---|---|---|---|
| bs=10 sw=10 sl=64 | throughput | 329 tuples/sec | 432 tuples/sec | 784.3 tuples/sec | -23.8% | -58.1% |
| bs=10 sw=10 sl=64 | MB/s | 0.201 MB/s | 0.264 MB/s | 0.479 MB/s | -23.9% | -58.0% |
| bs=10 sw=10 sl=64 | p50 | 27,839 us | 21,131 us | 12,590 us | +31.7% | +121.1% |
| bs=10 sw=10 sl=64 | p95 | 47,105 us | 34,328 us | 15,991 us | +37.2% | +194.6% |
| bs=10 sw=10 sl=64 | p99 | 47,105 us | 34,328 us | 18,694 us | +37.2% | +152.0% |
| bs=100 sw=10 sl=64 | throughput | 786 tuples/sec | 822 tuples/sec | 1,002 tuples/sec | -4.4% | -21.6% |
| bs=100 sw=10 sl=64 | MB/s | 0.48 MB/s | 0.502 MB/s | 0.612 MB/s | -4.4% | -21.5% |
| bs=100 sw=10 sl=64 | p50 | 123,305 us | 120,880 us | 101,285 us | +2.0% | +21.7% |
| bs=100 sw=10 sl=64 | p95 | 162,167 us | 154,066 us | 108,068 us | +5.3% | +50.1% |
| bs=100 sw=10 sl=64 | p99 | 162,167 us | 154,066 us | 118,235 us | +5.3% | +37.2% |
| bs=1000 sw=10 sl=64 | throughput | 904 tuples/sec | 924 tuples/sec | 1,030 tuples/sec | -2.2% | -12.2% |
| bs=1000 sw=10 sl=64 | MB/s | 0.552 MB/s | 0.564 MB/s | 0.629 MB/s | -2.1% | -12.2% |
| bs=1000 sw=10 sl=64 | p50 | 1,104,813 us | 1,083,952 us | 991,882 us | +1.9% | +11.4% |
| bs=1000 sw=10 sl=64 | p95 | 1,192,488 us | 1,135,815 us | 1,038,496 us | +5.0% | +14.8% |
| bs=1000 sw=10 sl=64 | p99 | 1,192,488 us | 1,135,815 us | 1,068,265 us | +5.0% | +11.6% |
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,607.52,200,128000,329,0.201,27839.49,47105.33,47105.33
1,100,10,64,20,2543.83,2000,1280000,786,0.480,123305.12,162167.16,162167.16
2,1000,10,64,20,22113.84,20000,12800000,904,0.552,1104813.45,1192487.81,1192487.81
What changes were proposed in this PR?
The browser-mode suite runs in CI and uploads its JUnit results, but never its coverage — so every line those tests exercise is reported as untested. This closes that gap. No test is added or changed.
Measured on
code-editor.component.tsby intersecting the two lcov records:So roughly three-fifths of that file's advertised gap is already tested. Any PR written off the Codecov ranking would have duplicated seven existing tests to move a number.
Passing
--coveragealone does not work. The run fails with:The coverage provider is imported dynamically once
--coverageis set, so it is not in the import graph Vite's scan crawls — the same reasonbufferalready needed an explicit hint in this config. Adding@vitest/coverage-v8/browsertooptimizeDeps.includefixes it. Note the failure mode: the tests still pass while the coverage step errors, which is why this went unnoticed.Three changes:
vitest.browser.config.ts— add theoptimizeDepsinclude, and write coverage tocoverage-browser/so it cannot overwrite the jsdom run'scoverage/gui/lcov.info(that upload happens earlier in the job).build.yml— pass--coverage --coverage-reporters=lcovonlyto the browser step and upload the result under the existingfrontendflag, which Codecov merges with the jsdom upload.frontend/.gitignore— ignore the new output directory.How was this PR tested?
Reproduced the failure on
mainfirst:ng run gui:test-browser --coverageexits 1 with three errors (Prepare / Run / Coverage) and produces no lcov, while the 7 tests pass.With the fix, the full browser suite:
exit 0, no errors, and
coverage-browser/lcov.infowritten with 98 files / 1942 lines recorded. The jsdom path is unaffected —ng test --coveragestill passes 25 tests and still writescoverage/gui/lcov.info.yarn format:cipasses.Any related issues, documentation, discussions?
Closes #7462
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 5)