2017-12-26 3 views
0

Angular5에서 카르마 유닛 테스트를 수행 할 때 몇 가지 문제점이 있습니다.Angular 5 카르마 유닛 테스트 버그

Chrome 63.0.3239 (Windows 7 0.0.0): Executed 3 of 29 SUCCESS (0 secs/ 2.516 secs) Chrome 63.0.3239 (Windows 7 0.0.0) ERROR Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/FollowersItemComponent_Host.ngfactory.js'. Chrome 63.0.3239 (Windows 7 0.0.0) ERROR Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/FollowersItemComponent_Host.ngfactory.js'.
at http://localhost:9876/_karma_webpack_/polyfills.bundle.js:2281 Chrome 63.0.3239 (Windows 7 0.0.0): Executed 3 of 29 ERROR (0 secs/ 2.516 secs) Chrome 63.0.3239 (Windows 7 0.0.0) ERROR Uncaught NetworkError: Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'ng:///DynamicTestModule/FollowersItemComponent_Host.ngfactory.js'. Chrome 63.0.3239 (Windows 7 0.0.0): Executed 3 of 29 ERROR (2.546 secs /2.516 secs)

왜 이런 문제가 발생했는지 확신 할 수 없습니다. 도와주세요. 감사.

답변

0

이 관리하는 경우 나도 몰라,하지만이 오류는 구성 요소가 기다리고있는 모든 입력에서 올 수 : 당신이 당신의 구성 요소에 @Input()를 가지고 있다면,이 입력을 제공 할 필요가

당신의 테스트에서. 일반적으로 이전 방법으로 수행 할 수 있습니다. 각 방법 :

beforeEach(() => { 
    fixture = TestBed.createComponent(YourComponent); 
    component = fixture.componentInstance; 
    component.yourInput = 'anyInput' 
}); 
관련 문제