Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runner): suite options do not propagate to nested suites (fix: #3467) #3473

Merged
merged 1 commit into from May 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions packages/runner/src/suite.ts
Expand Up @@ -199,10 +199,9 @@ function createSuite() {
if (typeof options === 'number')
options = { timeout: options }

if (currentSuite && typeof currentSuite.options?.repeats === 'number') {
// inherit repeats from current suite
options = { repeats: currentSuite.options.repeats, ...options }
}
// inherit options from current suite
if (currentSuite?.options)
options = { ...currentSuite.options, ...options }

return createSuiteCollector(name, factory, mode, this.concurrent, this.shuffle, this.each, options)
}
Expand Down
23 changes: 23 additions & 0 deletions test/core/test/propagate-options-nested-suite.test.ts
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest'

describe(
'suite name',
() => {
let outerCount = 0

it('should retry until success', () => {
outerCount++
expect(outerCount).toBe(5)
})

describe('nested', () => {
let innerCount = 0

it('should retry until success (nested)', () => {
innerCount++
expect(innerCount).toBe(5)
})
})
},
{ retry: 10 },
)