Skip to content

Frontend specs replace the parent template at test time, hiding it from coverage #5188

@Yicong-Huang

Description

@Yicong-Huang

Task Summary

Several frontend component specs replace the parent component's template at test time — either with overrideComponent({ set: { template: "" } }), with a stripped stub markup string, or with the broader overrideComponent({ set: { imports: [], schemas: [CUSTOM_ELEMENTS_SCHEMA] } }) form. The intent in each case is to keep heavy child components or directives out of the test build, but the side effect is that fixture.detectChanges() renders an empty or stub DOM, the real .component.html never executes, and v8 coverage records 0% for it — even though the specs themselves report green.

A handful of specs also carry schemas: [NO_ERRORS_SCHEMA], which Angular's own docs warn against because it hides real template typos and missing bindings. For Angular 19 standalone components the schema is usually unnecessary anyway: the parent's imports: array pulls the child graph in transitively, so unknown-element errors no longer fire.

Refactor the affected specs to render the real template, document the right approach in frontend/TESTING.md, and add ESLint rules so the patterns can't grow back.

Task Type

  • Testing / QA
  • Documentation

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions