Skip to content
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

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

Closed
6 tasks done
dsyddall opened this issue Oct 6, 2024 · 0 comments · Fixed by #6653
Closed
6 tasks done
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@dsyddall
Copy link
Contributor

dsyddall commented Oct 6, 2024

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

@hi-ogawa hi-ogawa added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Oct 6, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants