测试Angular材料6:意外的值' PropDecoratorFactory'由模块“DynamicTestModule”宣布'

时间:2018-05-14 06:18:28

标签: angular karma-jasmine angular-material2

在测试Angular Material 6.0.1组件时,我收到此错误:

  

意外的价值' PropDecoratorFactory'由模块' DynamicTestModule'声明。请添加@ Pipe / @ Directive / @ Component注释。

在浏览器中执行应用程序时没有问题,所以我猜错误与TestBed配置有关:

// this returns true
select 'A' like 'a'

// this returns false
select 'A' like binary 'a'


select * from user where email like binary 'a'

模板:

TestBed.configureTestingModule({
  imports: [ReactiveFormsModule, FormsModule ],
  declarations: [
    ChipInputAutoCompleteComponent,
    MatAutocomplete,
    MatFormField,
    MatOption,
    MatChipList,
    MatChip,
    MatIcon,
    Input
  ],
  providers: []
})

这是完整的示例:https://stackblitz.com/edit/angular-xas7g2?file=src%2Fapp%2Fchip-input-auto-complete%2Fchip-input-auto-complete.component.spec.ts组件'缺少实现,因为我认为它与这种错误无关(我在使用完全实现的组件在本地测试时遇到了同样的错误)。

0 个答案:

没有答案