diff --git a/packages/playwright/src/runner/loadUtils.ts b/packages/playwright/src/runner/loadUtils.ts index 5d0be6f943..230a7b8774 100644 --- a/packages/playwright/src/runner/loadUtils.ts +++ b/packages/playwright/src/runner/loadUtils.ts @@ -223,7 +223,7 @@ async function filterTestGroups(config: FullConfigInternal, testGroups: TestGrou const result = filter.filterTestGroups.call(filterThis, filteredTestGroups); filteredTestGroups = result instanceof Promise ? await result : result; } else if ('filterTests' in filter) { - const result = filter.filterTests.call(filterThis, filteredTestGroups.flatMap(group => group.tests), config.config); + const result = filter.filterTests.call(filterThis, filteredTestGroups.flatMap(group => group.tests)); const filteredTests = result instanceof Promise ? await result : result; if (!Array.isArray(filteredTests)) throw new Error('Invalid filter result: tests should be an array'); diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index 675e966df7..5815b90ada 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -1904,10 +1904,24 @@ export type TestDetails = { annotation?: TestDetailsAnnotation | TestDetailsAnnotation[]; } -type TestFilterThis = { config: FullConfig }; -type TestFilterFunction = (this: TestFilterThis, test: TestCase) => boolean; -type TestsFilter = { filterTests(this: TestFilterThis, tests: TestCase[]): Promise | TestCase[] }; -type TestGroupsFilter = { filterTestGroups(this: TestFilterThis, testGroups: { tests: TestCase[] }[]): Promise<{ tests: TestCase[] }[]> | { tests: TestCase[] }[] }; +type TestFilterThis = { + config: FullConfig +} + +export type TestFilterFunction = (this: TestFilterThis, test: TestCase) => boolean; + +export type TestsFilter = { + filterTests(this: TestFilterThis, tests: TestCase[]): Promise | TestCase[] +} + +export type TestGroup = { + tests: TestCase[] +}; + +export type TestGroupsFilter = { + filterTestGroups(this: TestFilterThis, testGroups: TestGroup[]): Promise | TestGroup[] +} + export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter; interface SuiteFunction { diff --git a/utils/generate_types/overrides-test.d.ts b/utils/generate_types/overrides-test.d.ts index 8c222213ae..c1d73af0f7 100644 --- a/utils/generate_types/overrides-test.d.ts +++ b/utils/generate_types/overrides-test.d.ts @@ -77,10 +77,24 @@ export type TestDetails = { annotation?: TestDetailsAnnotation | TestDetailsAnnotation[]; } -type TestFilterThis = { config: FullConfig }; -type TestFilterFunction = (this: TestFilterThis, test: TestCase) => boolean; -type TestsFilter = { filterTests(this: TestFilterThis, tests: TestCase[]): Promise | TestCase[] }; -type TestGroupsFilter = { filterTestGroups(this: TestFilterThis, testGroups: { tests: TestCase[] }[]): Promise<{ tests: TestCase[] }[]> | { tests: TestCase[] }[] }; +type TestFilterThis = { + config: FullConfig +} + +export type TestFilterFunction = (this: TestFilterThis, test: TestCase) => boolean; + +export type TestsFilter = { + filterTests(this: TestFilterThis, tests: TestCase[]): Promise | TestCase[] +} + +export type TestGroup = { + tests: TestCase[] +}; + +export type TestGroupsFilter = { + filterTestGroups(this: TestFilterThis, testGroups: TestGroup[]): Promise | TestGroup[] +} + export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter; interface SuiteFunction {