move classes to test-reporter

This commit is contained in:
Yury Semikhatsky 2024-04-01 16:04:31 -07:00
parent 8c4d009eea
commit 2f2a943740
3 changed files with 223 additions and 2 deletions

View file

@ -5,7 +5,7 @@
Runtime representation of the test project configuration that is passed
to [Reporter]. It exposes some of the resolved fields declared in
[TestProject]. You can get [FullProject] instance from [`property: FullConfig.projects`]
or [`property: Suite.project`].
or [`method: Suite.project`].
## property: FullProject.dependencies
* since: v1.31

View file

@ -20,7 +20,7 @@ export type { FullConfig, TestStatus, FullProject } from './test';
/**
* `Suite` is a group of tests. All tests in Playwright Test form the following hierarchy:
* - Root suite has a child suite for each {@link TestProject}.
* - Root suite has a child suite for each {@link FullProject}.
* - Project suite #1. Has a child suite for each test file in the project.
* - File suite #1
* - {@link TestCase} #1
@ -624,6 +624,227 @@ export type JSONReportSTDIOEntry = { text: string } | { buffer: string };
export {};
/**
* Resolved configuration passed to
* [reporter.onBegin(config, suite)](https://playwright.dev/docs/api/class-reporter#reporter-on-begin).
*/
export interface FullConfig {
/**
* Path to the configuration file (if any) used to run the tests.
*/
configFile?: string;
/**
* See [testConfig.forbidOnly](https://playwright.dev/docs/api/class-testconfig#test-config-forbid-only).
*/
forbidOnly: boolean;
/**
* See [testConfig.fullyParallel](https://playwright.dev/docs/api/class-testconfig#test-config-fully-parallel).
*/
fullyParallel: boolean;
/**
* See [testConfig.globalSetup](https://playwright.dev/docs/api/class-testconfig#test-config-global-setup).
*/
globalSetup: null|string;
/**
* See [testConfig.globalTeardown](https://playwright.dev/docs/api/class-testconfig#test-config-global-teardown).
*/
globalTeardown: null|string;
/**
* See [testConfig.globalTimeout](https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout).
*/
globalTimeout: number;
/**
* See [testConfig.grep](https://playwright.dev/docs/api/class-testconfig#test-config-grep).
*/
grep: RegExp|Array<RegExp>;
/**
* See [testConfig.grepInvert](https://playwright.dev/docs/api/class-testconfig#test-config-grep-invert).
*/
grepInvert: null|RegExp|Array<RegExp>;
/**
* See [testConfig.maxFailures](https://playwright.dev/docs/api/class-testconfig#test-config-max-failures).
*/
maxFailures: number;
/**
* See [testConfig.metadata](https://playwright.dev/docs/api/class-testconfig#test-config-metadata).
*/
metadata: Metadata;
/**
* See [testConfig.preserveOutput](https://playwright.dev/docs/api/class-testconfig#test-config-preserve-output).
*/
preserveOutput: "always"|"never"|"failures-only";
/**
* List of resolved projects.
*/
projects: Array<FullProject>;
/**
* See [testConfig.quiet](https://playwright.dev/docs/api/class-testconfig#test-config-quiet).
*/
quiet: boolean;
/**
* See [testConfig.reporter](https://playwright.dev/docs/api/class-testconfig#test-config-reporter).
*/
reporter: string|Array<{
/**
* Reporter name or module or file path
*/
0: string;
/**
* An object with reporter options if any
*/
1: Object;
}>|"list"|"dot"|"line"|"github"|"json"|"junit"|"null"|"html";
/**
* See [testConfig.reportSlowTests](https://playwright.dev/docs/api/class-testconfig#test-config-report-slow-tests).
*/
reportSlowTests: null|{
/**
* The maximum number of slow test files to report. Defaults to `5`.
*/
max: number;
/**
* Test duration in milliseconds that is considered slow. Defaults to 15 seconds.
*/
threshold: number;
};
rootDir: string;
/**
* See [testConfig.shard](https://playwright.dev/docs/api/class-testconfig#test-config-shard).
*/
shard: null|{
/**
* The total number of shards.
*/
total: number;
/**
* The index of the shard to execute, one-based.
*/
current: number;
};
/**
* See [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots).
*/
updateSnapshots: "all"|"none"|"missing";
/**
* Playwright version.
*/
version: string;
/**
* See [testConfig.webServer](https://playwright.dev/docs/api/class-testconfig#test-config-web-server).
*/
webServer: null|Object;
/**
* See [testConfig.workers](https://playwright.dev/docs/api/class-testconfig#test-config-workers).
*/
workers: number;
}
/**
* Runtime representation of the test project configuration that is passed to {@link Reporter}. It exposes some of the
* resolved fields declared in {@link TestProject}. You can get {@link FullProject} instance from
* [fullConfig.projects](https://playwright.dev/docs/api/class-fullconfig#full-config-projects) or
* [suite.project()](https://playwright.dev/docs/api/class-suite#suite-project).
*/
export interface FullProject {
/**
* See [testProject.dependencies](https://playwright.dev/docs/api/class-testproject#test-project-dependencies).
*/
dependencies: Array<string>;
/**
* See [testProject.grep](https://playwright.dev/docs/api/class-testproject#test-project-grep).
*/
grep: RegExp|Array<RegExp>;
/**
* See [testProject.grepInvert](https://playwright.dev/docs/api/class-testproject#test-project-grep-invert).
*/
grepInvert: null|RegExp|Array<RegExp>;
/**
* See [testProject.metadata](https://playwright.dev/docs/api/class-testproject#test-project-metadata).
*/
metadata: Metadata;
/**
* See [testProject.name](https://playwright.dev/docs/api/class-testproject#test-project-name).
*/
name: string;
/**
* See [testProject.outputDir](https://playwright.dev/docs/api/class-testproject#test-project-output-dir).
*/
outputDir: string;
/**
* See [testProject.repeatEach](https://playwright.dev/docs/api/class-testproject#test-project-repeat-each).
*/
repeatEach: number;
/**
* See [testProject.retries](https://playwright.dev/docs/api/class-testproject#test-project-retries).
*/
retries: number;
/**
* See [testProject.snapshotDir](https://playwright.dev/docs/api/class-testproject#test-project-snapshot-dir).
*/
snapshotDir: string;
/**
* See [testProject.teardown](https://playwright.dev/docs/api/class-testproject#test-project-teardown).
*/
teardown?: string;
/**
* See [testProject.testDir](https://playwright.dev/docs/api/class-testproject#test-project-test-dir).
*/
testDir: string;
/**
* See [testProject.testIgnore](https://playwright.dev/docs/api/class-testproject#test-project-test-ignore).
*/
testIgnore: string|RegExp|Array<string|RegExp>;
/**
* See [testProject.testMatch](https://playwright.dev/docs/api/class-testproject#test-project-test-match).
*/
testMatch: string|RegExp|Array<string|RegExp>;
/**
* See [testProject.timeout](https://playwright.dev/docs/api/class-testproject#test-project-timeout).
*/
timeout: number;
/**
* See [testProject.use](https://playwright.dev/docs/api/class-testproject#test-project-use).
*/
use: Fixtures;
}
/**
* Represents a location in the source code where {@link TestCase} or {@link Suite} is defined.
*/