You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jest uses os.availableParallelism() and os.cpus().length to figure out how many Jest workers to spawn. However, on CircleCI Docker executors, these function calls return invalid results.
For example, on my medium+ executor with 3 vCPU cores:
circleci@00740471180a:~$ node
Welcome to Node.js v18.16.0.
Type ".help" for more information.
> const os = require('os')
undefined
> os.availableParallelism()
36
> os.cpus().length
36
This causes frequent OOM errors and crashes, which are hard for the average user to debug. There are several feature requests to CircleCI to make this better:
Background
Jest uses
os.availableParallelism()
andos.cpus().length
to figure out how many Jest workers to spawn. However, on CircleCI Docker executors, these function calls return invalid results.For example, on my
medium+
executor with 3 vCPU cores:This causes frequent OOM errors and crashes, which are hard for the average user to debug. There are several feature requests to CircleCI to make this better:
nproc
accurately reporter number of CPUs available to containerHowever, I'm not holding my breath on them fixing this on their end.
Possible Solution
It looks like using this snippet reports the correct number of vCPUs available:
So, it would be great to automatically set
maxWorkers
via this, instead of the inaccurate defaults used byjest
.Notes
The text was updated successfully, but these errors were encountered: