jeudi 14 décembre 2017

Angular 5 jasmine tests and declarations

I have got question about testing angular 5 in jasmine.

when I create my test case for component I need to provide long list of components that it actually uses.

    TestBed.configureTestingModule({
        declarations: [
            AComponent,
            BComponent,
            CComponent,
            DComponent,
            EComponent,
            FComponent,
            GComponent,
            HComponent,
            IComponent,
            JComponent
        ],
        imports: [
            FormsModule,
            MatSliderModule
        ],
    })
        .compileComponents();

And in that scenario I am not using Material slider in component that I am testing, but I need to provide it in imports, because my DComponent is using slider.

Is there any way to Improve testing experience, so I dont have to provide all imports and declarations? For example I would like to provide only components that I want to mock. All the other comoponents should render in standard way

Aucun commentaire:

Enregistrer un commentaire