Skip to content

Commit db67831

Browse files
DORI2001Dor Alagemhi-ogawa
authored
fix(runner): propagate chainable flags in describe.for (#10187)
Co-authored-by: Dor Alagem <doralagem@MacBook-Pro-sl-Dor.local> Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
1 parent e3cb192 commit db67831

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

packages/runner/src/suite.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -707,13 +707,13 @@ function createSuite() {
707707
}
708708

709709
suiteFn.for = function <T>(
710-
this: {
711-
withContext: () => SuiteAPI
712-
setContext: (key: string, value: boolean | undefined) => SuiteAPI
713-
},
710+
this: SuiteAPI,
714711
cases: ReadonlyArray<T>,
715712
...args: any[]
716713
) {
714+
const context = getChainableContext(this)
715+
const suite = context.withContext()
716+
717717
if (Array.isArray(cases) && args.length) {
718718
cases = formatTemplateString(cases, args)
719719
}

test/core/test/test-for-suite.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ describe.for([
3333
expect(a + b).matchSnapshot()
3434
})
3535
})
36+
37+
// Regression test: describe.concurrent.for should propagate the concurrent flag
38+
// to the generated suites, matching how describe.for and test.concurrent.for behave.
39+
describe.concurrent.for([1, 2])('concurrent %i', (item) => {
40+
test('is marked concurrent', ({ task }) => {
41+
expect(task.suite!.concurrent).toBe(true)
42+
expect(task.concurrent).toBe(true)
43+
expect(item).toBeGreaterThan(0)
44+
})
45+
})

0 commit comments

Comments
 (0)