In the CircleCI cloud, your job may be running in various kinds of environments. Some of those environments could have lots of resources available but your jobs running in them only have access to a small slice of those available resources.
For instance, using the docker executor will often have your job running in a VM with thirty-two CPU cores available. This causes problems with testing tools like jest which by default will spawn workers based on the number of available CPU cores. It will think it has access to thirty-two cores, but in reality, while using a medium resource class, it only has access to two. This is a recipe for sadness. Be aware of how tools configure themselves according to their environment and be aware of what the environment is reporting to your tools.
In the case of jest you can tell it to limit the number of workers with the --maxWorkers= command line option.