apache / apache/texera

Browser-mode specs run without coverage, so ~75 tested lines report as uncovered

Open
#7,462 0 comments 0 reactions 1 assignee Claimed by @aglinxinyuan View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### Task Summary

Roughly **75 covered lines of `code-editor.component.ts` are missing from the coverage report** — not because they are untested, but because the tests that cover them never reach the coverage run.

`code-editor.component.browser.spec.ts` passes today and exercises most of the Monaco integration. Two things keep it out of the numbers:

1. `angular.json`'s `test` target sets `"exclude": ["**/*.browser.spec.ts"]`, so the jsdom coverage run skips it entirely.
2. `build.yml`'s `ng run gui:test-browser` step runs it, but with **no `--coverage` flag** and uploads only `junit-browser.xml` with `report_type: test_results` — so no lcov reaches Codecov.

The result is that `code-editor.component.ts` reports 47% and appears near the top of every coverage-gap ranking, when the real gap is far smaller. Anyone working from that ranking will write ~75 lines of duplicate tests for behaviour that is already covered.

### Suggested next steps

Either:

- **add coverage to the browser step** — pass `--coverage --coverage-reporters=lcovonly` to `ng run gui:test-browser` and upload the resulting lcov alongside the jsdom one; or
- **fold the browser specs back into jsdom.** A throwaway probe confirmed this now works: nothing in the file needs a real Monaco — a plain fake-editor object plus `vi.spyOn(EditorApp.prototype, "start"/"getEditor")` and a stubbed `ensureVscodeApiStarted` executes `initializeMonacoEditor`, `initializeDiffEditor`, `setupAIAssistantActions`, `handleTypeAnnotation` and `adjustEditorSize`.

The first is cheaper and preserves the browser-mode signal; the second removes a second test mode.

Whichever is chosen, the same question applies to any other `*.browser.spec.ts` in the repo — their coverage is invisible for the same reason.

### Additional context

Found while ranking the remaining coverage gaps toward a 100% target. This one file distorts the ranking enough to be worth fixing before anyone works the list. Related: #7458, a different reason coverage under-reports (templates behind `TestBed.overrideComponent`).

### Task Type

- [ ] Refactor / Cleanup
- [x] DevOps / Deployment / CI
- [ ] Testing / QA
- [ ] Documentation
- [ ] Performance
- [ ] Other

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.