Oscar Franco

Speed up Jest (by using multiple cores)

August 2023

You can increase jest speed by passing the amount of workers, this works wonders on a m1 machine, use the following npm scripts:

"test": "jest --maxWorkers=50%",
"test:watch": "jest --maxWorkers=50% --watch",

For CI jobs, where you usually don’t have many processors running the tests sequentially provides the best results

"test:ci": "jest --testLocationInResults --runInBand --ci --outputFile=test_results.json --json",