fix(api): hide TestConfig.groups (#17853)

Also fix types for `FullConfig.configFile`.
This commit is contained in:
Dmitry Gozman 2022-10-05 14:24:14 -07:00 committed by GitHub
parent 795730f665
commit 6750a02506
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 61 deletions

View File

@ -84,12 +84,6 @@ const config: PlaywrightTestConfig = {
export default config;
```
## property: TestConfig.configFile
* since: v1.27
- type: ?<[string]>
Path to config file, if any.
## property: TestConfig.forbidOnly
* since: v1.10
- type: ?<[boolean]>
@ -232,17 +226,6 @@ Filter to only run tests with a title **not** matching one of the patterns. This
`grepInvert` option is also useful for [tagging tests](../test-annotations.md#tag-tests).
## property: TestConfig.groups
* since: v1.27
- type: ?<[Object]<[string],[Array]<[string]|[Array]<[string]|[Object]>>>>
- `project` <[string]|[Array]<[string]>> Project name(s).
- `grep` ?<[RegExp]|[Array]<[RegExp]>> Filter to only run tests with a title matching one of the patterns.
- `grepInvert` ?<[RegExp]|[Array]<[RegExp]>> Filter to only run tests with a title **not** matching one of the patterns.
- `testMatch` ?<[string]|[RegExp]|[Array]<[string]|[RegExp]>> Only the files matching one of these patterns are executed as test files. Matching is performed against the absolute file path. Strings are treated as glob patterns.
- `testIgnore` ?<[string]|[RegExp]|[Array]<[string]|[RegExp]>> Files matching one of these patterns are not executed as test files. Matching is performed against the absolute file path. Strings are treated as glob patterns.
Project groups that control project execution order.
## property: TestConfig.ignoreSnapshots
* since: v1.26
- type: ?<[boolean]>

View File

@ -165,7 +165,10 @@ export class Loader {
this._fullConfig.metadata = takeFirst(config.metadata, baseFullConfig.metadata);
this._fullConfig.projects = (config.projects || [config]).map(p => this._resolveProject(config, this._fullConfig, p, throwawayArtifactsPath));
this._assignUniqueProjectIds(this._fullConfig.projects);
this._fullConfig.groups = config.groups;
// TODO: restore or remove once groups are decided upon.
this._fullConfig.groups = (config as any).groups;
validateProjectGroups(this._configFile || '<default config>', this._fullConfig);
}
private _assignUniqueProjectIds(projects: FullProjectInternal[]) {
@ -533,8 +536,6 @@ function validateConfig(file: string, config: Config) {
});
}
validateProjectGroups(file, config);
if ('quiet' in config && config.quiet !== undefined) {
if (typeof config.quiet !== 'boolean')
throw errorWithFile(file, `config.quiet must be a boolean`);
@ -641,7 +642,7 @@ function validateProject(file: string, project: Project, title: string) {
}
}
function validateProjectGroups(file: string, config: Config) {
function validateProjectGroups(file: string, config: FullConfigInternal) {
if (config.groups === undefined)
return;
const projectNames = new Set(config.projects?.filter(p => !!p.name).map(p => p.name));

View File

@ -578,11 +578,6 @@ interface TestConfig {
};
};
/**
* Path to config file, if any.
*/
configFile?: string;
/**
* Whether to exit with an error if any tests or groups are marked as
* [test.only(title, testFunction)](https://playwright.dev/docs/api/class-test#test-only) or
@ -683,38 +678,6 @@ interface TestConfig {
*/
grepInvert?: RegExp|Array<RegExp>;
/**
* Project groups that control project execution order.
*/
groups?: { [key: string]: Array<string|Array<string|{
/**
* Project name(s).
*/
project: string|Array<string>;
/**
* Filter to only run tests with a title matching one of the patterns.
*/
grep?: RegExp|Array<RegExp>;
/**
* Filter to only run tests with a title **not** matching one of the patterns.
*/
grepInvert?: RegExp|Array<RegExp>;
/**
* Only the files matching one of these patterns are executed as test files. Matching is performed against the absolute
* file path. Strings are treated as glob patterns.
*/
testMatch?: string|RegExp|Array<string|RegExp>;
/**
* Files matching one of these patterns are not executed as test files. Matching is performed against the absolute file
* path. Strings are treated as glob patterns.
*/
testIgnore?: string|RegExp|Array<string|RegExp>;
}>>; };
/**
* Whether to skip snapshot expectations, such as `expect(value).toMatchSnapshot()` and `await
* expect(page).toHaveScreenshot()`.
@ -1337,9 +1300,6 @@ export interface FullConfig<TestArgs = {}, WorkerArgs = {}> {
*
*/
webServer: TestConfigWebServer | null;
/**
* Path to config file, if any.
*/
configFile?: string;
}

View File

@ -573,6 +573,7 @@ class TypesGenerator {
['PlaywrightTestArgs', 'Fixtures'],
]),
ignoreMissing: new Set([
'FullConfig.configFile',
'FullConfig.version',
'FullConfig.rootDir',
'SuiteFunction',