Angular 2 unit testing - getting error Failed to load 'ng:///DynamicTestModule/module.ngfactory.js'

前端 未结 10 2378
执念已碎
执念已碎 2020-12-23 11:04

I have angular 2 webpack application, all webpack,karma configuration created as per angular.io webpack guide. I am not using aot. I am writing jasmine unit test spec to te

10条回答
  •  温柔的废话
    2020-12-23 11:46

    I was bitten by the same error next day - this time the problem was buried in the HTML file. Using a simple array length test for *ngIf

    
    

    had to be refactored into

    
    

    with a getter as in:

    get myArrayNotEmpty(){
      return this.myArray && this.myArray.length > 0;
    }
    

    I am a bit irritated though that such a variety of causes is covered by one very misleading and unhelpful message.

提交回复
热议问题