Skip to content

Commit 9fb9dac

Browse files
authored
fix(runner): suite options do not propagate to nested suites (fix: #3467) (#3473)
1 parent 4c9a7d5 commit 9fb9dac

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

packages/runner/src/suite.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,9 @@ function createSuite() {
199199
if (typeof options === 'number')
200200
options = { timeout: options }
201201

202-
if (currentSuite && typeof currentSuite.options?.repeats === 'number') {
203-
// inherit repeats from current suite
204-
options = { repeats: currentSuite.options.repeats, ...options }
205-
}
202+
// inherit options from current suite
203+
if (currentSuite?.options)
204+
options = { ...currentSuite.options, ...options }
206205

207206
return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, this.each, options)
208207
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
describe(
4+
'suite name',
5+
() => {
6+
let outerCount = 0
7+
8+
it('should retry until success', () => {
9+
outerCount++
10+
expect(outerCount).toBe(5)
11+
})
12+
13+
describe('nested', () => {
14+
let innerCount = 0
15+
16+
it('should retry until success (nested)', () => {
17+
innerCount++
18+
expect(innerCount).toBe(5)
19+
})
20+
})
21+
},
22+
{ retry: 10 },
23+
)

0 commit comments

Comments
 (0)