Skip to content

Commit

Permalink
fix(runner): Ensure inner suite { sequential: true } correctly overri…
Browse files Browse the repository at this point in the history
…des outer suite { concurrent: true } (#5737)
  • Loading branch information
pengooseDev authored May 17, 2024
1 parent 1ec61ce commit a20e75b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 5 additions & 3 deletions packages/runner/src/suite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
7 changes: 3 additions & 4 deletions test/core/test/concurrent-suite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a20e75b

Please sign in to comment.