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

Nested suites run tests serially inside a concurrent suite #4480

Closed
6 tasks done
dsyddall opened this issue Nov 11, 2023 · 0 comments · Fixed by #4482
Closed
6 tasks done

Nested suites run tests serially inside a concurrent suite #4480

dsyddall opened this issue Nov 11, 2023 · 0 comments · Fixed by #4482

Comments

@dsyddall
Copy link
Contributor

dsyddall commented Nov 11, 2023

Describe the bug

The documentation for describe.sequential states that it has the function of running tests serially within a describe.concurrent suite. However, there is no difference in behaviour between describe and describe.sequential. Both types of suite run tests serially, making describe.sequential have no effect.

For example, both of the following tests have the same behaviour:

With describe.sequential:

describe.concurrent('concurrent suite', () => {
  test('concurrent test 1', async () => { /* ... */ })
  test('concurrent test 2', async () => { /* ... */ })

  describe.sequential('sequential suite', () => {
    test('sequential test 1', async () => { /* ... */ })
    test('sequential test 2', async () => { /* ... */ })
  })
})

With describe:

describe.concurrent('concurrent suite', () => {
  test('concurrent test 1', async () => { /* ... */ })
  test('concurrent test 2', async () => { /* ... */ })

  describe('sequential suite', () => {
    test('sequential test 1', async () => { /* ... */ })
    test('sequential test 2', async () => { /* ... */ })
  })
})

Reproduction: https://stackblitz.com/edit/vitest-dev-vitest-ri5bfg?file=nested-concurrent.test.ts

Expected behaviour

Tests within nested suites inside a concurrent suite run concurrently but can be changed to run sequentially using describe.sequential. I.e.:

describe.concurrent('concurrent suite', () => {
  test('concurrent test 1', async () => { /* ... */ })
  test('concurrent test 2', async () => { /* ... */ })

  describe('nested concurrent suite', () => {
    test('concurrent test 3', async () => { /* ... */ })
    test('concurrent test 4', async () => { /* ... */ })
  })

  describe.sequential('sequential suite', () => {
    test('sequential test 1', async () => { /* ... */ })
    test('sequential test 2', async () => { /* ... */ })
  })
})

Proposed fix

Ensure that concurrent/sequential options are inherited from the parent suite.

Reproduction

https://stackblitz.com/edit/vitest-dev-vitest-ri5bfg?file=nested-concurrent.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

@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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant