How to reproduce Jest “Network Error” - floating bug locally

Viewed 1082

When I run tests on pipe lines occasionally I am getting "Network Error" for different files (because of axios requests). Though some times I don't get errors at all.

But for some reason I can't get that error locally no matter what I do. I use same node version v12.16.1. I have tried to reduce testTimeout to 200 (I got bunch of errors but the were different).

  1. So the question is why that error is inconsistent?
  2. How I can make it consistent and reproduce it locally?

enter image description here

2 Answers

The problem was that one test didn't finished request properly, though test itself finished successfully. As the result next test with request failed. And because of default maxConcurrency: 5 that could be pretty any test.

Though why I was unable to reproduce it locally is still unclear for me.

Related