각도 -cli (1.0.0-beta.26)을 사용하여 만든 각도 (2.4.5) 응용 프로그램이 있고 테스트하는 데 어려움이 있습니다.각도 2 테스트 격리 (템플릿 오류)
import { Component } from '@angular/core';
@Component({
selector: 'app-empty',
templateUrl: './empty.component.html',
styleUrls: ['./empty.component.css']
})
export class EmptyComponent { }
(.html 중에서 및 .CSS 모두 빈 파일입니다) 및 단위 테스트 :
Uncaught Error: Template parse errors: Can't bind to 'value' since it
isn't a known property of 'app-detail-section-item'.
:
npm run test
테스트를 시작
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { EmptyComponent } from './empty.component';
describe('EmptyComponent',() => {
let component: EmptyComponent;
let fixture: ComponentFixture<EmptyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ EmptyComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EmptyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create',() => {
expect(component).toBeTruthy();
});
});
이 오류와 함께 실패 나는 간단한 구성 요소가
이는 테스트중인 다른 구성 요소와 관련이 있습니다. 왜 내가이 컴포넌트가 EmptyComponent 테스트에 영향을 미치는지 이해할 수 없다. Webpack은 테스트를 함께 묶어 놓기 때문입니까? 테스트가 격리 될 것으로 기대됩니다. schemas: [NO_ERRORS_SCHEMA]
을 사용하여 테스트를 통과 할 수는 있지만 그렇게하는 것이 옳지 않은 것 같습니다.
콘솔에서 전체 출력을 제공 할 수 있습니까? –
@MezoIstvan 여기에서 찾으십시오 - https://drive.google.com/file/d/0B5ymVhu1SZm0d3pPQUhOT3RhaEk/view?usp=sharing (여기에 붙여 넣기에는 너무 큽니다). – sax