Angular2 Dart TestComponentBuilder失败,“没有TestComponentBuilder的提供者!”

时间:2016-11-15 18:43:23

标签: unit-testing angular dart

我尝试在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...
  }

0 个答案:

没有答案