Skip to content

describe.concurrent.for doesn't enable concurrent #10181

@hi-ogawa

Description

@hi-ogawa

Describe the bug

Just noticed test.concurrent.for enables concurrent but describe.concurrent.for doesn't.

For example, the following is expected to run inner beforeAll of siblings in parallel, also inner test x and test y in parallel, but it doesn't.

import { describe, beforeAll, afterAll, test } from 'vitest';

const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

describe.concurrent.for(['a', 'b', 'c'])('%s', () => {
  beforeAll(async ({}, suite) => {
    console.log('!> beforeAll', suite.name, suite.concurrent);
    await sleep(10);
  });

  afterAll(async ({}, suite) => {
    console.log('!> afterAll', suite.name);
  });

  test('test x', async ({ task }) => {
    console.log('!> test x', task.suite!.name, task.concurrent);
    await sleep(10);
    console.log('!> test x (done)', task.suite!.name);
  });

  test('test y', async ({ task }) => {
    console.log('!> test y', task.suite!.name);
    await sleep(10);
    console.log('!> test y (done)', task.suite!.name);
  });
});

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-dmkudkvr?file=test%2Frepro.test.ts

System Info

Stackblitz

Used Package Manager

npm

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    p3-minor-bugAn edge case that only affects very specific usage (priority)

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions