Jest 28’s Dynamic maxWorkers Setting Introducing Latency Under High Concurrency
0 reputation · 13 Jun 2020, 20:29 UTC
When running a Jest test suite with many files, the observed latency per test increases only when the number of concurrently executing files exceeds the default worker pool size, while sequential execution shows stable timing.
The goal is to determine whether this latency originates from the dynamic maxWorkers calculation, the re‑execution of global setup/teardown hooks in each worker, or the overhead added by the --detectOpenHandles flag, and how these factors interact with Node.js version and hardware thread scheduling.
Consider the constraints that the behavior may differ across Jest 27‑29, that future worker‑thread implementations could change the effect, and that CI environments often have limited cores.
What specific configuration (maxWorkers, runInBand, or disabling detectOpenHandles) most directly reduces the concurrent‑only latency? How much of the latency is attributable to global hook re‑execution versus worker‑pool queuing? Does enabling --detectOpenHandles produce a measurable latency increase beyond the baseline worker‑pool effect?