2017-04-04 21 views
6

Yasemin ile birim testlerimi yapıyorum ve şubeyle ilgili bir sorum var.Kuruculardaki şubeler kapsanmadı

Kod bölümünün neden görebildiğimiz gibi dalların kaplanmadığını gösterdiğinin farkında olan var mı? Ne yazık ki köşeli bir hata olduğunu ben açısal 4'e benim projelerini yükseltilmiş andan itibaren aydır aynı sorunu yaşadım

describe('MyComponent',() => { 
    let component: MyComponent; 
    let fixture: ComponentFixture<MyComponent>; 
    let myService: MyService; 

    beforeEach(async(() => { 
    TestBed.configureTestingModule({ 
     declarations: [ MyComponent ], 
     imports: [ MaterializeModule, FormsModule, ReactiveFormsModule, HttpModule ], 
     providers: [ 
     MyService, 
     FormBuilder 
     ] 
    }) 
    .compileComponents(); 
    })); 

    beforeEach(() => { 
    fixture = TestBed.createComponent(MyComponent); 
    component = fixture.componentInstance; 
    slotsService = TestBed.get(MyService); 
    fixture.detectChanges(); 
    }); 

    function updateForm(name, surname) { 
    component.myForm.controls['name'].setValue(name); 
    component.myForm.controls['surname'].setValue(name); 
    } 

    it('should create',() => { 
    expect(component).toBeTruthy(); 
    }); 
} 
+1

Bana verilen bağlantı sorunu çözebilir aynı sorunu –

cevap

1

orada, bu sorunu bakan ve yine% 100 şube kapsama ulaşmak istiyorsanız en azından bir geçici çözümdür (bkz. https://github.com/angular/angular-cli/issues/5526#issuecomment-324429322).

Basitçe (satır araları olmadan) sınıfı ihracat sonra /* istanbul ignore next */ ekleyin:

export class InternalComponent { 
    constructor(private authService: any) { 
    } 
} /* istanbul ignore next */ 
İlgili konular