【问题标题】:Jest test stuck on bitbucket pipelines without any errorJest test stuck on bitbucket pipelines without any error
【发布时间】:2022-12-02 06:41:58
【问题描述】:

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?

【问题讨论】:

  • Did you find a solution to this issue, we are facing the same problem.
  • I realized that jest is taking too much memory and cpu now ( and I don't know why ) and I think that's why it's getting stucked on BitBucket Pipelines. Unfortunately I didn't find a solution.
  • I didnt fixed it yet, but i'm running one test at time and it kind of "solve" the problema bit it takes 10 times the time into the pipeline

标签: jestjs bitbucket nestjs bitbucket-pipelines ts-jest


【解决方案1】:

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.

【讨论】:

    【解决方案2】:

    Another solution that worked better for me than the above was to double the size of the build container. You will also get faster pipelines (albeit at marginally higher cost), so just do the tradeoff to see what works best in your case. You can double the size of the build container with the following size: 2x option in the bitbucket-pipelines.yml.

    ...
          - step
              name: Run Unit Tests
              image: node:14.17.0
              size: 2x
    ...
    

    More info here: https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/

    【讨论】:

      猜你喜欢
      • 2020-11-26
      • 1970-01-01
      • 1970-01-01
      • 2022-12-28
      • 2020-01-22
      • 1970-01-01
      • 2022-12-19
      • 1970-01-01
      • 2019-08-17
      相关资源
      最近更新 更多