Skip to content

Commit 69c3516

Browse files
9aoyCopilot
andauthored
fix: describe.each type error (#707)
Co-authored-by: Copilot <[email protected]>
1 parent 8cd2fe4 commit 69c3516

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

e2e/describe/each.test.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { afterAll, describe, expect, it } from '@rstest/core';
33
const logs: string[] = [];
44

55
afterAll(() => {
6-
expect(logs.length).toBe(6);
6+
expect(logs.length).toBe(7);
77
});
88

99
describe.each([
@@ -27,3 +27,21 @@ describe.each([
2727
logs.push('executed');
2828
});
2929
});
30+
interface TestCase {
31+
name: string;
32+
targets: string[];
33+
}
34+
35+
const TEST_CASES: TestCase[] = [
36+
{
37+
name: 'react-16',
38+
targets: ['node'],
39+
},
40+
];
41+
42+
describe.each(TEST_CASES)('test case $name', ({ name, targets }) => {
43+
it(`should run ${name}`, () => {
44+
expect(targets).toBeDefined();
45+
logs.push('executed');
46+
});
47+
});

packages/core/src/types/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export interface DescribeEachFn {
6565
<T extends readonly [unknown, ...unknown[]]>(
6666
cases: readonly T[],
6767
): (description: string, fn: (...args: [...T]) => MaybePromise<void>) => void;
68+
<T>(
69+
cases: readonly T[],
70+
): (description: string, fn: (param: T) => MaybePromise<void>) => void;
6871
}
6972

7073
export type DescribeForFn = <T>(

0 commit comments

Comments
 (0)