Skip to content

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

Closed

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

Activity

  1. added a commit that references this issue on May 24, 2026
    07492f7
  2. added a commit that references this issue on May 24, 2026
    cbe90c7
  3. added a commit that references this issue on Jun 22, 2026
    0d2e62c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions