2016-12-06 74 views
1

我正在使用VMware的Clarity组件进行角度2方案的POC测试。当我运行测试运行,我收到以下错误:使用VMware Clarity模块进行角度2单元测试

'clr-main-container' is not a known element: 
1. If 'clr-main-container' is an Angular component, then verify that it is part of this module. 
2. If 'clr-main-container' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]<clr-main-container> 

我是新来的角2,我无法找到任何谷歌。

+0

嗨@agillette测试连线。看起来你还没有注册'ClarityModule'。需要更多的细节来了解完整的问题。什么是测试跑步者?你在使用Clarity种子项目吗?我建议通过Clarity入门页面:https://vmware.github.io/clarity/get-started#seedProjectClarity并使用他们的种子应用程序。 – takeradi

回答

2

agillette, 您可能在测试中缺少Testbed配置。喜欢的东西:

import {async, ComponentFixture, TestBed} from "@angular/core/testing"; 
 
import {ClarityModule} from 'clarity-angular'; 
 

 
describe('...', function() { 
 

 
    beforeEach(() => { 
 
    TestBed.configureTestingModule({ 
 
     imports: [ClarityModule.forRoot()], 
 
     declarations: [YourTestComponent] 
 
    }); 
 
    }); 
 

 
});

您可以了解更多关于测试床here

而且随时检查出Clarity seed一个简单的工作应用程序在。