-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
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.4Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.