1

I am using Angular with Jest. While running ng test (nx test in my case because I am using nrwl/nx), I got this error for a component while the last test was hanging:

Call retries were exceeded at ChildProcessWorker.initialize

alexander
  • 79
  • 1
  • 1
  • 6

1 Answers1

1

I later found out that I had a setTimeout in my AfterViewInit() hook and this caused the error.

If you have a timer in your component, do the following in order to fix it:

  • have a look on this answer: Test a function that contains a setTimeout()
  • look on the documentation and on this article to see how to use fakeAsync() and tick() for testing async code
  • if that doesn't work, wrap you test case in a setTimeout() with the same number of milliseconds as the on in the component and that should do the trick
alexander
  • 79
  • 1
  • 1
  • 6