ava
ava copied to clipboard
Limit simultaneous tests executed across all files
I'm creating tests based on Playwright. I have a macro that handles creation of browser and passing it further to the test context. And the thing is that it is impossible to limit amount of tests executed at the same time in a single file. Even if I set concurrency to 1 if I have 10 tests in a file it will create 10 pages for each test which is quite a lot by itself, but if there is some concurrency greater than 1, it means that amount is multiplied by that factor. Of course this can be addressed by not putting too many tests in a single file, but then it lower down AVA's usage experience a bit (at least for me it is great to have all the tests for a feature in the same file).
So would be nice to have ability to limit amount of executed tests at the same time. Maybe it could be done with some kind of shared worker (looks like great promising feature).
Yes, shared workers would be the best approach here.
https://github.com/avajs/cooperate implements locks. Support could be added there to implement mutexes that limit parallel execution.
Ideally we'd also be able to initialize the shared context through the AVA configuration.