We support many variants to specify test concurrency:
https://stackblitz.com/edit/vitest-dev-vitest-tyqqgjgn?file=test%2Frepro.test.ts
test.concurrent('a', () => {});
test.sequential('b', () => {});
test('a', { concurrent: true }, () => {});
test('a', { concurrent: false }, () => {});
test('b', { sequential: true }, () => {});
test('b', { sequential: false }, () => {}); // is this even concurrent?
concurrent and sequantial are direct negation of each other and thus inherently redundant. Having independent options cause quite a churn internally and it can be also confusing for end users, so they should be consolidated into one flag.
The end users should switch to either of:
test.concurrent('a', () => {});
test('a', { concurrent: true }, () => {});
test('b', { concurrent: false }, () => {}); // force sequential inside concurrent
Some notorious examples of internal churns:
|
const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false |
|
const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false |
|
// inherit concurrent / sequential from suite |
|
const concurrent = this.concurrent ?? (!this.sequential && options?.concurrent) |
|
if (options.concurrent != null && concurrent != null) { |
|
options.concurrent = concurrent |
|
} |
|
|
|
const sequential = this.sequential ?? (!this.concurrent && options?.sequential) |
|
if (options.sequential != null && sequential != null) { |
|
options.sequential = sequential |
|
} |
We support many variants to specify test concurrency:
https://stackblitz.com/edit/vitest-dev-vitest-tyqqgjgn?file=test%2Frepro.test.ts
concurrentandsequantialare direct negation of each other and thus inherently redundant. Having independent options cause quite a churn internally and it can be also confusing for end users, so they should be consolidated into one flag.The end users should switch to either of:
Some notorious examples of internal churns:
vitest/packages/runner/src/suite.ts
Lines 605 to 606 in a36c1e7
vitest/packages/runner/src/suite.ts
Lines 453 to 462 in a36c1e7