Tôi có một đường ống tùy chỉnh được gọi là 'myPipe'. Tôi nhận được ống 'myPipe' không thể tìm thấy lỗi trong ts thử nghiệm đơn vị của tôi.Góc 2 Đơn vị kiểm tra: Lỗi ống tùy chỉnh Đường ống không thể được tìm thấy
Pleas lời khuyên gì để nhập khẩu và tuyên bố trong .spec.ts tôi
đây là .spec.ts tôi
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { MyComponent } from './main-page-carousel.component';
describe('CarouselComponent',() => {
let component: MyComponent ;
let fixture: ComponentFixture<MyComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MyComponent ],
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create',() => {
expect(component).toBeTruthy();
});
});
Cảm ơn!
bạn đang nói về 'myPipe' nhưng thử nghiệm của bạn có liên quan đến 'CarouselComponent'? bạn không nên nhập 'myPipe' thay thế? –
Kiểm tra mục nhập "không tìm thấy đường ống" này: http://stackoverflow.com/questions/39007130/the-pipe-could-not-be-found-angular2-custom-pipe/40770507#40770507 – Karl