feat(test-runner): pass config to test group filters
This commit is contained in:
parent
e215fb5c48
commit
c929ee4e67
|
|
@ -196,10 +196,10 @@ export async function createRootSuite(testRun: TestRun, errors: TestError[], sho
|
||||||
const allTests = new Set(filteredTestGroups.flatMap(group => group.tests));
|
const allTests = new Set(filteredTestGroups.flatMap(group => group.tests));
|
||||||
for (const filter of filters) {
|
for (const filter of filters) {
|
||||||
if ('filterTestGroups' in filter) {
|
if ('filterTestGroups' in filter) {
|
||||||
filteredTestGroups = filter.filterTestGroups(filteredTestGroups);
|
filteredTestGroups = filter.filterTestGroups(filteredTestGroups, config.config);
|
||||||
} else if ('filterTests' in filter) {
|
} else if ('filterTests' in filter) {
|
||||||
filteredTestGroups = filteredTestGroups.map(group => {
|
filteredTestGroups = filteredTestGroups.map(group => {
|
||||||
return { tests: filter.filterTests(group.tests) };
|
return { tests: filter.filterTests(group.tests, config.config) };
|
||||||
});
|
});
|
||||||
} else if (typeof filter === 'function') {
|
} else if (typeof filter === 'function') {
|
||||||
filteredTestGroups = filteredTestGroups.map(group => {
|
filteredTestGroups = filteredTestGroups.map(group => {
|
||||||
|
|
|
||||||
4
packages/playwright/types/test.d.ts
vendored
4
packages/playwright/types/test.d.ts
vendored
|
|
@ -1886,8 +1886,8 @@ export type TestDetails = {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestFilterFunction = (test: TestCase) => boolean;
|
type TestFilterFunction = (test: TestCase) => boolean;
|
||||||
type TestsFilter = { filterTests(tests: TestCase[]): TestCase[] }
|
type TestsFilter = { filterTests(tests: TestCase[], config: FullConfig): TestCase[] };
|
||||||
type TestGroupsFilter = { filterTestGroups(testGroups: { tests: TestCase[] }[]): { tests: TestCase[] }[] }
|
type TestGroupsFilter = { filterTestGroups(testGroups: { tests: TestCase[] }[], config: FullConfig): { tests: TestCase[] }[] }
|
||||||
export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter;
|
export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter;
|
||||||
|
|
||||||
interface SuiteFunction {
|
interface SuiteFunction {
|
||||||
|
|
|
||||||
4
utils/generate_types/overrides-test.d.ts
vendored
4
utils/generate_types/overrides-test.d.ts
vendored
|
|
@ -78,8 +78,8 @@ export type TestDetails = {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestFilterFunction = (test: TestCase) => boolean;
|
type TestFilterFunction = (test: TestCase) => boolean;
|
||||||
type TestsFilter = { filterTests(tests: TestCase[]): TestCase[] }
|
type TestsFilter = { filterTests(tests: TestCase[], config: FullConfig): TestCase[] };
|
||||||
type TestGroupsFilter = { filterTestGroups(testGroups: { tests: TestCase[] }[]): { tests: TestCase[] }[] }
|
type TestGroupsFilter = { filterTestGroups(testGroups: { tests: TestCase[] }[], config: FullConfig): { tests: TestCase[] }[] }
|
||||||
export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter;
|
export type TestFilter = TestFilterFunction | TestsFilter | TestGroupsFilter;
|
||||||
|
|
||||||
interface SuiteFunction {
|
interface SuiteFunction {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue