Angular 6 Unit Tests: An error was thrown in afterAll\nReferenceError: Can't find variable: $ thrown

前端 未结 10 1535
栀梦
栀梦 2020-12-23 09:25

When running my unit tests, from time to time, even if they pass, at the end of all the tests running, I will get the following error.

On my Jenkins CI build running

10条回答
  •  借酒劲吻你
    2020-12-23 10:20

    I had similar issue as well. In my angular 10 project. Out of 10 times, 8 times it would fail with afterall error. Turns out, in spec.ts files, the imports should have HttpClientTestingModule instead of HttpClientModule. Try this. It might solve the random error in Afterall issue.

提交回复
热议问题