qunitjs / qunitjs/qunit

[Feature Request]: Option to run tests in parallel?

Open
#1,777 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Core Type: Enhancement Type: Meta
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.