我尝试在Angular2 Dart中编写一个简单的组件测试,当我使用No provider for TestComponentBuilder!
运行它时卡在pub run test -j1 -p dartium
我的测试看起来像这样:
@Component(
selector: 'test-cmp',
template: '<textarea \n\n</textarea>')
class TestComponent {}
void main() {
initAngularTests();
ngTest('New component test', (TestComponentBuilder testComponentBuilder) async {
final testComponent = await testComponentBuilder.createAsync(TestComponent);
testComponent.detectChanges();
print(testListComponent);
//expect(to be done...);
});
}
好的,我现在也将示例移植到上面提到的测试库中。现在我得到No precompiled component TestComponent found
void main() {
reflector.reflectionCapabilities = new ReflectionCapabilities();
test('New event list component is empty', () async {
print('test start');
var testBed = new NgTestBed<TestComponent>();
var fixture = await testBed.create();
// expect...
}