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

How to test Angular custom elements and do coverage in module ngDoBootstrap

Discussão em 'Angular' iniciado por BAceAlight, Setembro 16, 2025.

  1. BAceAlight

    BAceAlight Guest

    Module Config

    • I would like to complete coverage in my module but can seem to find a way of referencing/spyOn the customElements.define inside the bootstrap.

    bonus:


    • help with the useFactory coverage would be much appreciated.


    • this test pass so far.

    it('initializes', () => {
    const module: AppModule = TestBed.inject(AppModule);
    expect(module).toBeTruthy();
    });

    it('ngDoBootstrap', () => {
    const module: AppModule = TestBed.inject(AppModule);
    spyOn(module, "ngDoBootstrap");
    module.ngDoBootstrap();
    expect(module.ngDoBootstrap).toHaveBeenCalled();
    });

    Continue reading...

Compartilhe esta Página