我运行ng test
进行单元测试时遇到以下异常
Failed: Can't resolve all parameters for DecoratorFactory: (?)
在下面的specs.ts
文件中处理异常。我在用户界面中使用ngx-bootstrap组件
describe('DirectoryComponent', () => {
let component: DirectoryComponent;
let fixture: ComponentFixture<DirectoryComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ DirectoryComponent ],
imports: [ FormsModule,TypeaheadModule,BsDatepickerModule, CarouselModule, RouterTestingModule,ModalModule.forRoot() ],
providers:[GlobalService, ServerService , OtherservicesService,MyModalsService,Pipe],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(DirectoryComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});