[Feature Request]: Option to run tests in parallel?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 4k
- Forks
- 773
- PR merge metrics
- No merged PRs in 30d
Description
I would be great if I could declare a module as parallel, like this:
import { module, test } from 'qunit';
module.parallel('my suite', function (hooks) {
// all 3 of these tests run "at the same time"
test('a', async function (assert) {
await 0;
assert.ok(true);
});
test('b', async function (assert) {
await 0;
assert.ok(true);
});
test('c', async function (assert) {
await 0;
assert.ok(true);
});
});
these tests are overly simplified, but I imagine this could lead to implementation of:
// psuedo code
if (module.isParallel) {
await Promise.all(module.tests.map(test => runTest(test)));
} else {
// current behavior
for (let test of module.tests) {
await runTest(test);
}
}
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue provides a proposed API and pseudocode but names no implementation files, tests, or entry points. Begin by locating the test-runner execution path and determine how module isolation, async tests, ordering, and worker support should be handled; done requires an agreed design and coverage for concurrent execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100