You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Template coverage does not register for components whose spec calls TestBed.overrideComponent #7458
Six component templates report 0% coverage despite having substantial, passing specs, and adding tests to them does not change the number. Together they account for roughly 230 uncovered lines that no amount of test writing can reach.
Template
Spec size
Reported
hub-workflow-detail.component.html
442-line spec, 7 detectChanges
0%
user-project.component.html
262-line spec
0%
search.component.html
242-line spec
0%
workspace.component.html
—
0%
hub-search-result.component.html
—
0%
search-results.component.html
—
75.8% (partial)
The common factor is TestBed.overrideComponent. Across the repo, templates whose spec calls it average 18% coverage with 6 of 8 at zero; templates whose spec does not average 76.7%, with only 2 of 73 at zero. Every one of these specs uses the additive remove/add: { imports } form to swap heavyweight child components for stubs — they do not override the template itself, so the real template genuinely renders and is genuinely exercised. It simply is not attributed.
Two counterexamples (search-results, operator-property-edit-frame) also call overrideComponent and do report coverage, so overrideComponent alone is not a sufficient explanation and the precise trigger is still unidentified.
Why this matters
These files look like the largest remaining coverage gaps in the frontend, so they attract effort that cannot pay off. Two separate coverage sweeps ranked hub-workflow-detail (46 lines) and user-project (38 lines) near the top of the backlog before the pattern was spotted. Anyone working from the Codecov file list will keep rediscovering them.
Suggested next steps
Confirm the mechanism — most likely the component recompilation overrideComponent triggers produces a template with a different identity than the one the coverage remapper knows about.
If it cannot be fixed, exclude these templates from the coverage denominator so the reported figure reflects what is actually testable, and note the reason.
Either way, record it somewhere discoverable so the next person ranking targets does not spend the effort again.
Root cause found, and measured rather than inferred.
The mechanism.TestBed.overrideComponent makes Angular re-JIT the component from its retained decorator metadata (pendingComponents → compileComponent → jitExpression). The re-compiled template function carries no source map back to the .component.html, so every binding still executes and none of it is attributed. That is why the affected components show a healthy .ts next to a .html at exactly zero — agent-panel.component.ts is 98.5% with 0 of 133 lines missed while agent-panel.component.html is 0/49. Nothing but attribution loss produces that pair.
All eight zero-coverage templates are now accounted for, by correlating every one of the 98 .html files in the live Codecov report:
Template
Lines
Cause
agent-panel
49
overridden in its only rendering spec
hub-workflow-detail
46
same
user-project
38
same
search
35
same
workspace
28
same
hub-search-result
25
same
ui-udf-parameters
—
spec never uses TestBed (new UiUdfParametersComponent())
The two overridden specs whose templates are covered confirm the mechanism from the other direction: search-results.component.html (75.8%) and operator-property-edit-frame.component.html (68.2%) each have a sibling spec that renders the real component un-overridden.
The remedy works.#7535 applies it to hub-workflow-detail:
Before
After
lines
0/46 (0.0%)
45/46 (97.8%)
branches
—
3/3
Three tests, and the existing 32 are untouched — the new block keeps its own TestBed so those tests keep their mocked WorkflowActionService and the ten assertions they make on it. Wholesale de-stubbing would mean rewriting those ten, which is a worse trade than adding a render block.
One thing that should change regardless of whether anyone picks up the remaining five.frontend/.eslintrc.json currently prescribes the pattern that causes this, in three separate messages — the NO_ERRORS_SCHEMA rule and both overrideComponent rules all tell authors to "stub it via overrideComponent({ remove: { imports: [Real] }, add: { imports: [Stub] } })". The set: { template } message is right that substituting a template zeroes coverage, but the additive remove/add form it recommends instead does the same thing, for the same reason. Accurate guidance would be: any override zeroes the template's coverage, so prefer expanding the child's service stubs so the real child can instantiate, and if a child genuinely cannot be, add a sibling block that renders the real component.
Happy to send that eslintrc wording as its own small PR if that is wanted — I kept it out of #7535 so the test change stays spec-only.
Activity
aglinxinyuan commentedon Aug 11, 2026
Root cause found, and measured rather than inferred.
The mechanism.
TestBed.overrideComponentmakes Angular re-JIT the component from its retained decorator metadata (pendingComponents→compileComponent→jitExpression). The re-compiled template function carries no source map back to the.component.html, so every binding still executes and none of it is attributed. That is why the affected components show a healthy.tsnext to a.htmlat exactly zero —agent-panel.component.tsis 98.5% with 0 of 133 lines missed whileagent-panel.component.htmlis 0/49. Nothing but attribution loss produces that pair.All eight zero-coverage templates are now accounted for, by correlating every one of the 98
.htmlfiles in the live Codecov report:agent-panelhub-workflow-detailuser-projectsearchworkspacehub-search-resultui-udf-parametersnew UiUdfParametersComponent())collab-wrapperThe two overridden specs whose templates are covered confirm the mechanism from the other direction:
search-results.component.html(75.8%) andoperator-property-edit-frame.component.html(68.2%) each have a sibling spec that renders the real component un-overridden.The remedy works. #7535 applies it to
hub-workflow-detail:Three tests, and the existing 32 are untouched — the new block keeps its own
TestBedso those tests keep their mockedWorkflowActionServiceand the ten assertions they make on it. Wholesale de-stubbing would mean rewriting those ten, which is a worse trade than adding a render block.One thing that should change regardless of whether anyone picks up the remaining five.
frontend/.eslintrc.jsoncurrently prescribes the pattern that causes this, in three separate messages — theNO_ERRORS_SCHEMArule and bothoverrideComponentrules all tell authors to "stub it viaoverrideComponent({ remove: { imports: [Real] }, add: { imports: [Stub] } })". Theset: { template }message is right that substituting a template zeroes coverage, but the additiveremove/addform it recommends instead does the same thing, for the same reason. Accurate guidance would be: any override zeroes the template's coverage, so prefer expanding the child's service stubs so the real child can instantiate, and if a child genuinely cannot be, add a sibling block that renders the real component.Happy to send that eslintrc wording as its own small PR if that is wanted — I kept it out of #7535 so the test change stays spec-only.
test(frontend): render the hub workflow detail with its real children (…
test(frontend): render the agent panel with its real children (apache…
test(frontend): render the dashboard search with its real children (a…
test(frontend): render the hub search result with its real children (a…
test(frontend): drive the dataset detail template through the DOM (ap…
test(frontend): cover the websocket handshake, port editor binding an…
test(frontend): cover the compiling service and the search-results te…
fix(frontend): give unit tests timeout headroom for loaded macOS runn…
test(frontend): cover the console frame's controls and the preset gua…
test(frontend): cover the operator label drag, computing-unit rows an…
test(frontend): render the small templates instead of calling their h…
test(frontend): close the branch arms left in the dataset explorer co…