Hi,
What I did so far :
I made sure that my circleci config.yml contains the right image version image: cimg/node:16.13
I sshd into the circleci container
The error I get is the following
/project/scripts/test.sh: line 3: 634 Killed TZ=UTC NODE_ENV=test SYSTEM_UNDER_TEST=client JEST_JUNIT_OUTPUT=reports/junit/junit_client.xml jest --ci --reporters=default --reporters=jest-junit --coverageDirectory=reports/coverage/client --coverage --maxWorkers=2 --logHeapUsage
scripty ERR! script failed: '/project/scripts/test.sh'
scripty ERR! exit status: 137
I also run my test locally within a container with image cimg/node:16.13 and I reproduce the same error
I don’t know what to do at this point, what could be different between my local environment and the circleci image container
Basically in circle the unit test are hanging forever and exit eventually with 137
EDIT:
I did 2 test within circleci
First test with Jest26 => Test run
Second with Jest 27 => Test hang forever
However they both work on my local
I’ve also tried --runInBand and --clearCache does not work
yannCI
January 25, 2022, 11:19pm
2
Hello @jaybe78 ,
Welcome to the CircleCI community, and thanks for the post!
This error (exit status: 137
) is typically caused by memory exhaustion.
This can happen when the script looks at the number of CPUs available on the physical machine, which can be 32+
cores, rather than the number vCPUs the Docker container has been allocated.
The number of workers/threads your test suites uses will need to be configured to not exceed the number of vCPUs allocated to the resource class in use.
In the case of jest you can limit the number of workers with the --maxWorkers=
command line option .
Let me know if this helps.
Do not use Jest with Node >= 16.11.0
opened 09:18AM - 13 Oct 21 UTC
Upstream Bug
### Version
27.0.6
### Steps to reproduce
1. Install the latest Node JS… (16.11.0 or later) or use the appropriate Docker image
2. Set up a project with a multiplicity Jest tests
3. Run `node --expose-gc node_modules/.bin/jest --logHeapUsage` and see how the memory consumption starts increasing.
### Expected behavior
Since Jest calls `global.gc()` when Garbage Collector is exposed and `--logHeapUsage` flag is present, the memory usage should be stable.
### Actual behavior
The memory usage increases with every new test
### Additional context
We had some issues with Jest workers consuming all available RAM both on CI machine and locally.
After doing some research, we found that if we run Jest like the following `node --expose-gc node_modules/.bin/jest --logHeapUsage`, the heap size remains stable. After upgrading to Node JS v16.11.0, the issue was back. Node v16.10.0 works fine. I believe it was something accidentally introduced in the new Node, but it might be useful to take a look at this from Jest perspective in search of possible workarounds.
I'm also having the same behavior on my working machine, environment of which I'm pasting below 👇🏻
### Environment
```shell
System:
OS: macOS 11.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
Binaries:
Node: 16.11.0 - ~/.nvm/versions/node/v16.11.0/bin/node
Yarn: 1.22.0 - ~/SomeFancyDir/webapp/node_modules/.bin/yarn
npm: 8.0.0 - ~/.nvm/versions/node/v16.11.0/bin/npm
npmPackages:
jest: 27.0.6 => 27.0.6
```