1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular testing - Do you have to import tested component upon calling configureTestingModule

Discussão em 'Angular' iniciado por Lukasz Prus, Agosto 9, 2025.

  1. Lukasz Prus

    Lukasz Prus Guest

    See examples here: https://angular.dev/guide/testing/components-scenarios, they all have imports: [BannerComponent]. Is it necessary? Tests seem to run fine without it. I am assuming that the component is standalone

    beforeEach(() => {
    TestBed.configureTestingModule({
    imports: [BannerComponent], // This line
    });
    fixture = TestBed.createComponent(BannerComponent);
    component = fixture.componentInstance;
    h1 = fixture.nativeElement.querySelector('h1');
    });

    Continue reading...

Compartilhe esta Página