Skip to content

Regression: When sequence.concurrent is true, tests in a sequential suite run concurrently #6652

@dsyddall

Description

@dsyddall

Describe the bug

Original issue report: #4473

The documentation for describe.sequential states that tests should run sequentially inside a sequential suite when Vitest is run with the --sequence.concurrent option enabled, however tests actually run concurrently.

Reproduction

Run the following tests with the --sequence.concurrent option:

import { describe, expect, test } from 'vitest';

const delay = (timeout: number) =>
  new Promise((resolve) => setTimeout(resolve, timeout));

let count = 0;

describe.sequential('sequential suite', () => {
  test('test 1', async ({ task }) => {
    await delay(2000);
    expect(task.concurrent).toBeFalsy();
    expect(++count).toBe(1);
  });

  test('test 2', ({ task }) => {
    expect(task.concurrent).toBeFalsy();
    expect(++count).toBe(2);
  });
});

The tests pass in Vitest versions 1.0.0 through to 1.6.0, but fail in version 2.0.0 onwards.

https://stackblitz.com/edit/vitest-dev-vitest-yvqmqc?file=package.json,sequential.test.ts

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 6.34 GB / 31.20 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 18.20.4 - ~/.nvm/versions/node/v18.20.4/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.4/bin/yarn
    npm: 10.7.0 - ~/.nvm/versions/node/v18.20.4/bin/npm
    pnpm: 9.12.0 - ~/.nvm/versions/node/v18.20.4/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.70
  npmPackages:
    @vitest/browser: workspace:* => 2.1.2 
    @vitest/coverage-istanbul: workspace:* => 2.1.2 
    @vitest/coverage-v8: workspace:* => 2.1.2 
    @vitest/ui: workspace:* => 2.1.2 
    vite: ^5.4.0 => 5.4.0 
    vitest: workspace:* => 2.1.2

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

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions