From a20e75b8913ca5bf94d5242af6e78943f15689da Mon Sep 17 00:00:00 2001 From: Pengoose Date: Fri, 17 May 2024 20:40:00 +0900 Subject: [PATCH] fix(runner): Ensure inner suite { sequential: true } correctly overrides outer suite { concurrent: true } (#5737) --- packages/runner/src/suite.ts | 8 +++++--- test/core/test/concurrent-suite.test.ts | 7 +++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/runner/src/suite.ts b/packages/runner/src/suite.ts index 36b830f92f55..bbdf068e4211 100644 --- a/packages/runner/src/suite.ts +++ b/packages/runner/src/suite.ts @@ -286,9 +286,11 @@ function createSuite() { if (currentSuite?.options) options = { ...currentSuite.options, ...options } - // inherit concurrent / sequential from current suite - options.concurrent = this.concurrent || (!this.sequential && options?.concurrent) - options.sequential = this.sequential || (!this.concurrent && options?.sequential) + // inherit concurrent / sequential from suite + const isConcurrent = options.concurrent || (this.concurrent && !this.sequential) + const isSequential = options.sequential || (this.sequential && !this.concurrent) + options.concurrent = isConcurrent && !isSequential + options.sequential = isSequential && !isConcurrent return createSuiteCollector(formatName(name), factory, mode, this.shuffle, this.each, options) } diff --git a/test/core/test/concurrent-suite.test.ts b/test/core/test/concurrent-suite.test.ts index 56bac82a7818..11c8bc2d9a3d 100644 --- a/test/core/test/concurrent-suite.test.ts +++ b/test/core/test/concurrent-suite.test.ts @@ -119,10 +119,9 @@ describe('override concurrent', { concurrent: true }, () => { checkSequentialTests() }) - // TODO: not working? - // describe('s-x-2', { sequential: true, }, () => { - // checkSequentialTests() - // }) + describe('s-x-2', { sequential: true }, () => { + checkSequentialTests() + }) describe('s-y', () => { checkParallelTests()