-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Option to run tests in parallel? #1777
Comments
That sounds great to me! I've seen ad-hoc ways to do this in a few places already. Most recently, I did one myself here in this repo to speed up the CLI tests. qunit/test/cli/helpers/execute.js Line 194 in 2e9e9a9
Lines 13 to 22 in 2e9e9a9
A few things that come to mind:
In terms of API, the natural choice is a submethod indeed, but we do have a lot of them now: https://qunitjs.com/api/QUnit/module/ And more are coming in #1772. For concurrency, perhaps we can use an option instead. QUnit.module('example', { concurrency: boolean | number }, function ( hooks ) {
QUnit.test();
QUnit.test();
QUnit.test();
}); Given that Another idea would be to add it to the QUnit.module('example', function ( hooks ) {
hooks.enableParallel();
QUnit.test();
QUnit.test();
QUnit.test();
});
Yeah, that's something we can't really do in core, but something the CLI and runners like Testem could do. See previous discussion at "Split tests for parallelization". #947. To do this well, without needing to have upfront awareness of the modules and tests, you'd want to deterministically shard and filter by moduleId. This has been requested in "Dynamically filter tests to run". #1183 as well. |
Fixture reset. If we think parallel is likely to be useful in a browser, we may want to give each test its own fixture. That could involve providing an automatic DOM reference like "this.fixture" or "assert.getFixture()", or some other mechanism.
|
If we limit this to the CLI, then a safer option would be to use sub processes indeed. A fairly straightforward approach could be to spread out by test file. This is more crude in that tests concentrated in one module wouldn't run in parallel. But this might be offset by the gain in true parallel main threads, and by having entire modules run concurrently. |
I would be great if I could declare a
module
as parallel, like this:these tests are overly simplified, but I imagine this could lead to implementation of:
this could greatly improve the performance of async tests that may be I/O bound (and thus await-ing on external things to happen)
maybe this should be
module.concurrent
, since you can't actually have single-threaded parallelism.to have parallelism, you'd need to split test-running in to workers -- which would be useful as well -- and maybe easier from a context isolation perspective?
The text was updated successfully, but these errors were encountered: