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

When sequence.concurrent is true, tests in a sequential suite run concurrently #4473

Closed
6 tasks done
dsyddall opened this issue Nov 10, 2023 · 2 comments
Closed
6 tasks done
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) pr welcome

Comments

@dsyddall
Copy link
Contributor

Describe the bug

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

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);
  });
});

https://stackblitz.com/edit/vitest-dev-vitest-mpeirq?file=sequential.test.ts

Expected behaviour

When running the test suite above with vitest --sequence.concurrent, the tests run sequentially and pass.

Actual behaviour

Tests run concurrently and fail.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-mpeirq?file=sequential.test.ts

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.4.2 - /usr/local/bin/npm
    pnpm: 8.9.2 - /usr/local/bin/pnpm
  npmPackages:
    @vitest/ui: 1.0.0-beta.4 => 1.0.0-beta.4 
    vite: latest => 4.5.0 
    vitest: 1.0.0-beta.4 => 1.0.0-beta.4

Used Package Manager

npm

Validations

Copy link

stackblitz bot commented Nov 10, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@sheremet-va sheremet-va added bug pr welcome p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Nov 11, 2023
@dsyddall
Copy link
Contributor Author

Fixed by #4482

@github-actions github-actions bot locked and limited conversation to collaborators Nov 30, 2023
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) pr welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants