Jest test stuck on bitbucket pipelines without any error

Viewed 873

We use Bitbucket pipelines in our CI for testing, Our application is NestJS with Typescript tested with Jest.

We always got all tests running, however few days from now (2022 may) the tests are stuck after some suit, the suite where the test stuck is quite random.

The tests dont fail, we dont have any memory warning or anything else, it just is stucked on the pipeline. We need to stop the pipeline because it never stop.

Unfourtunately we dont any error for furgher investigation.

What could we do to inspect more details?

1 Answers

I was facing the same issue and I noticed that jest was consuming all the resources, so what worked for me was to set CPU usage limit during the tests using the following command:

jest --maxWorkers=20%

And I found this solution reading this amazing article here

Without this parameter, jest would consume all the resources of the docker machine on Bitbucket, potentially increasing runtime.

Related