Skip to content

Deprecate and remove sequential: boolean from test/suite options in favor of its negation concurrent: boolean #10180

@hi-ogawa

Description

@hi-ogawa

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
}

Metadata

Metadata

Assignees

Labels

p2-nice-to-haveNot breaking anything but nice to have (priority)

Type

No type

Projects

Status

Approved

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions