Exclude TestBed.configureTestingModule in unit test code for Standalone Component

Open
#29,399 0 comments 0 reactions 1 assignee View on GitHub

@clydin is already working on this.

Since Feb 18, 2025.

Assessment

This issue has not been assessed yet.

Description

area: @schematics/angular
Command

generate

Description

Hi,
I not sure if there is any current plan for this.
Currently, generating a new component with Angular CLI includes the below statement

await TestBed.configureTestingModule({
      imports: [ProductListComponent]
    })
    .compileComponents();
Describe the solution you'd like

Given that TestBed.configureTestingModule is no longer required, as component is standalone by default, the statement should be excluded from the generated unit test file (to avoid cluttering the code) when generating component with Angular CLI , unless standalone option is turned off explicitly

Describe alternatives you've considered

No response

Dominant language
TypeScript
Stars
27k
Forks
11.8k
Avg merge
16h 35m
Merged PRs (30d)
176

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from angular/angular-cli

All issues in angular/angular-cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.