Karma Start Fails - HeadlessChrome - ERROR Uncaught [object Object]

后端 未结 4 698
不知归路
不知归路 2020-12-15 06:49

I am using Karma to run test on my Angular 4 app. It works locally but when it runs on my host environment (Travis CI) it fails with the following informati

4条回答
  •  时光说笑
    2020-12-15 07:30

    This is what fixed it for me:

    I searched the whole project for occurrences of HttpClientModule in all *.spec.ts files. Turned out I had a few!

    Then I replaced all occurrences of

    import { HttpClientModule } from '@angular/common/http';
    

    with

    import { HttpClientTestingModule } from '@angular/common/http/testing';
    

    And then I made sure that the entry in the imports array of each of my test's TestBed.configureTestingModule was changed from HttpClientModule to HttpClientTestingModule.

    And finally I turned my Wifi off and ran the tests again. And voilà: It worketh!

提交回复
热议问题