We need a way to limit to execute tests in a single file concurrently without swamping the CPU
See original GitHub issue🚀 Feature Proposal
test.concurrent needs some kind or limit to its concurrency to prevent it swamping the CPU. – or – Something like test.farm which feeds the tests into a worker farm rather than immediately executing them.
Motivation
I use puppeteer with jest-image-snapshot to perform visual regression testing. I use globby to gather a list of output html files and feed them into test(), I’d like to feed them into test.concurrent() but that then tries to open 200 tabs at the same time then things go wrong very quickly.
Example
I’m thinking this should probably be the default operation of the feature, much like the maxWorkers
option. If people are confident their code will behave fully concurrently then perhaps expose a maxConcurrentWorkers
option.
– or –
test.farm(‘test name’, async() => { // Some big horrible test });
Pitch
test.concurrent is a core feature, it makes sense for it to be addressed here.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:13
- Comments:7 (1 by maintainers)
Top GitHub Comments
In case someone comes across this looking to limit concurrency: https://jestjs.io/docs/en/cli#maxconcurrency-num
If you’re willing to split your
test.concurrent
into different files, I wrote a concurrent test runner. Instead of the default of running each file in a different process, it runs them concurrently. You can control the concurrency withmaxConcurrentTests
.