Revert public types
This commit is contained in:
parent
0f4002e95c
commit
51cdd27080
|
|
@ -22,7 +22,7 @@ import type { Annotation, FixturesWithLocation, FullProjectInternal } from './co
|
||||||
import type { FullProject } from '../../types/test';
|
import type { FullProject } from '../../types/test';
|
||||||
import type { Location } from '../../types/testReporter';
|
import type { Location } from '../../types/testReporter';
|
||||||
|
|
||||||
abstract class Base {
|
class Base {
|
||||||
title: string;
|
title: string;
|
||||||
_only = false;
|
_only = false;
|
||||||
_requireFile: string = '';
|
_requireFile: string = '';
|
||||||
|
|
@ -39,7 +39,7 @@ export type Modifier = {
|
||||||
description: string | undefined
|
description: string | undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
export class Suite extends Base implements reporterTypes.Suite {
|
export class Suite extends Base {
|
||||||
location?: Location;
|
location?: Location;
|
||||||
parent?: Suite;
|
parent?: Suite;
|
||||||
_use: FixturesWithLocation[] = [];
|
_use: FixturesWithLocation[] = [];
|
||||||
|
|
@ -68,7 +68,7 @@ export class Suite extends Base implements reporterTypes.Suite {
|
||||||
return this._type;
|
return this._type;
|
||||||
}
|
}
|
||||||
|
|
||||||
entries(): (reporterTypes.Suite | reporterTypes.TestCase)[] {
|
entries() {
|
||||||
return this._entries;
|
return this._entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ type TeleReporterReceiverOptions = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export class TeleReporterReceiver {
|
export class TeleReporterReceiver {
|
||||||
private _rootSuite: TeleRootSuite;
|
private _rootSuite: TeleSuite;
|
||||||
private _options: TeleReporterReceiverOptions;
|
private _options: TeleReporterReceiverOptions;
|
||||||
private _reporter: Partial<ReporterV2>;
|
private _reporter: Partial<ReporterV2>;
|
||||||
private _tests = new Map<string, TeleTestCase>();
|
private _tests = new Map<string, TeleTestCase>();
|
||||||
|
|
@ -139,13 +139,13 @@ export class TeleReporterReceiver {
|
||||||
private _config!: reporterTypes.FullConfig;
|
private _config!: reporterTypes.FullConfig;
|
||||||
|
|
||||||
constructor(reporter: Partial<ReporterV2>, options: TeleReporterReceiverOptions) {
|
constructor(reporter: Partial<ReporterV2>, options: TeleReporterReceiverOptions) {
|
||||||
this._rootSuite = new TeleRootSuite();
|
this._rootSuite = new TeleSuite('', 'root');
|
||||||
this._options = options;
|
this._options = options;
|
||||||
this._reporter = reporter;
|
this._reporter = reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
this._rootSuite.reset();
|
this._rootSuite._entries = [];
|
||||||
this._tests.clear();
|
this._tests.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,11 +202,11 @@ export class TeleReporterReceiver {
|
||||||
private _onProject(project: JsonProject) {
|
private _onProject(project: JsonProject) {
|
||||||
let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find(suite => suite.project()!.name === project.name) : undefined;
|
let projectSuite = this._options.mergeProjects ? this._rootSuite.suites.find(suite => suite.project()!.name === project.name) : undefined;
|
||||||
if (!projectSuite) {
|
if (!projectSuite) {
|
||||||
projectSuite = new TeleProjectSuite(project.name);
|
projectSuite = new TeleSuite(project.name, 'project');
|
||||||
this._rootSuite._addSuite(projectSuite);
|
this._rootSuite._addSuite(projectSuite);
|
||||||
}
|
}
|
||||||
// Always update project in watch mode.
|
// Always update project in watch mode.
|
||||||
(projectSuite as TeleProjectSuite)._project = this._parseProject(project);
|
projectSuite._project = this._parseProject(project);
|
||||||
for (const suite of project.suites)
|
for (const suite of project.suites)
|
||||||
this._mergeSuiteInto(suite, projectSuite);
|
this._mergeSuiteInto(suite, projectSuite);
|
||||||
}
|
}
|
||||||
|
|
@ -339,7 +339,7 @@ export class TeleReporterReceiver {
|
||||||
private _mergeSuiteInto(jsonSuite: JsonSuite, parent: TeleSuite): void {
|
private _mergeSuiteInto(jsonSuite: JsonSuite, parent: TeleSuite): void {
|
||||||
let targetSuite = parent.suites.find(s => s.title === jsonSuite.title);
|
let targetSuite = parent.suites.find(s => s.title === jsonSuite.title);
|
||||||
if (!targetSuite) {
|
if (!targetSuite) {
|
||||||
targetSuite = parent.type === 'project' ? new TeleFileSuite(jsonSuite.title) : new TeleDescribeSuite(jsonSuite.title);
|
targetSuite = new TeleSuite(jsonSuite.title, parent.type === 'project' ? 'file' : 'describe');
|
||||||
parent._addSuite(targetSuite);
|
parent._addSuite(targetSuite);
|
||||||
}
|
}
|
||||||
targetSuite.location = this._absoluteLocation(jsonSuite.location);
|
targetSuite.location = this._absoluteLocation(jsonSuite.location);
|
||||||
|
|
@ -397,23 +397,26 @@ export class TeleReporterReceiver {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class TeleSuite implements reporterTypes.Suite {
|
export class TeleSuite implements reporterTypes.Suite {
|
||||||
title: string;
|
title: string;
|
||||||
abstract location?: reporterTypes.Location;
|
location?: reporterTypes.Location;
|
||||||
abstract parent?: reporterTypes.Suite;
|
parent?: TeleSuite;
|
||||||
|
_entries: (TeleSuite | TeleTestCase)[] = [];
|
||||||
_requireFile: string = '';
|
_requireFile: string = '';
|
||||||
_timeout: number | undefined;
|
_timeout: number | undefined;
|
||||||
_retries: number | undefined;
|
_retries: number | undefined;
|
||||||
|
_project: TeleFullProject | undefined;
|
||||||
_parallelMode: 'none' | 'default' | 'serial' | 'parallel' = 'none';
|
_parallelMode: 'none' | 'default' | 'serial' | 'parallel' = 'none';
|
||||||
readonly _type: 'root' | 'project' | 'file' | 'describe';
|
private readonly _type: 'root' | 'project' | 'file' | 'describe';
|
||||||
_entries: (TeleSuite | TeleTestCase)[] = [];
|
|
||||||
|
|
||||||
constructor(title: string, type: 'root' | 'project' | 'file' | 'describe') {
|
constructor(title: string, type: 'root' | 'project' | 'file' | 'describe') {
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this._type = type;
|
this._type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract type: 'root' | 'project' | 'file' | 'describe';
|
get type() {
|
||||||
|
return this._type;
|
||||||
|
}
|
||||||
|
|
||||||
get suites(): TeleSuite[] {
|
get suites(): TeleSuite[] {
|
||||||
return this._entries.filter(e => e.type !== 'test') as TeleSuite[];
|
return this._entries.filter(e => e.type !== 'test') as TeleSuite[];
|
||||||
|
|
@ -423,7 +426,7 @@ export abstract class TeleSuite implements reporterTypes.Suite {
|
||||||
return this._entries.filter(e => e.type === 'test') as TeleTestCase[];
|
return this._entries.filter(e => e.type === 'test') as TeleTestCase[];
|
||||||
}
|
}
|
||||||
|
|
||||||
entries(): (reporterTypes.Suite | reporterTypes.TestCase)[] {
|
entries() {
|
||||||
return this._entries;
|
return this._entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -449,7 +452,9 @@ export abstract class TeleSuite implements reporterTypes.Suite {
|
||||||
return titlePath;
|
return titlePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract project(): TeleFullProject | undefined;
|
project(): TeleFullProject | undefined {
|
||||||
|
return this._project ?? this.parent?.project();
|
||||||
|
}
|
||||||
|
|
||||||
_addTest(test: TeleTestCase) {
|
_addTest(test: TeleTestCase) {
|
||||||
test.parent = this;
|
test.parent = this;
|
||||||
|
|
@ -464,59 +469,6 @@ export abstract class TeleSuite implements reporterTypes.Suite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class TeleDescribeSuite extends TeleSuite implements reporterTypes.DescribeSuite {
|
|
||||||
type: 'describe' = 'describe';
|
|
||||||
override location!: reporterTypes.Location;
|
|
||||||
override parent!: TeleDescribeSuite | TeleFileSuite;
|
|
||||||
constructor(title: string) {
|
|
||||||
super(title, 'project');
|
|
||||||
}
|
|
||||||
override project(): TeleFullProject {
|
|
||||||
return this.parent.project()!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TeleFileSuite extends TeleSuite implements reporterTypes.FileSuite {
|
|
||||||
type: 'file' = 'file';
|
|
||||||
override location!: reporterTypes.Location;
|
|
||||||
override parent!: TeleProjectSuite;
|
|
||||||
constructor(title: string) {
|
|
||||||
super(title, 'project');
|
|
||||||
}
|
|
||||||
override project(): TeleFullProject {
|
|
||||||
return this.parent.project();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TeleProjectSuite extends TeleSuite implements reporterTypes.ProjectSuite {
|
|
||||||
type: 'project' = 'project';
|
|
||||||
_project!: TeleFullProject;
|
|
||||||
override location = undefined;
|
|
||||||
override parent!: TeleRootSuite;
|
|
||||||
constructor(title: string) {
|
|
||||||
super(title, 'project');
|
|
||||||
}
|
|
||||||
override project(): TeleFullProject {
|
|
||||||
return this._project!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TeleRootSuite extends TeleSuite implements reporterTypes.RootSuite {
|
|
||||||
type: 'root' = 'root';
|
|
||||||
override location = undefined;
|
|
||||||
override parent = undefined;
|
|
||||||
constructor() {
|
|
||||||
super('', 'root');
|
|
||||||
}
|
|
||||||
override project(): undefined {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
reset() {
|
|
||||||
this._entries = [];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class TeleTestCase implements reporterTypes.TestCase {
|
export class TeleTestCase implements reporterTypes.TestCase {
|
||||||
title: string;
|
title: string;
|
||||||
fn = () => {};
|
fn = () => {};
|
||||||
|
|
|
||||||
23
packages/playwright/types/testReporter.d.ts
vendored
23
packages/playwright/types/testReporter.d.ts
vendored
|
|
@ -237,29 +237,6 @@ export interface TestCase {
|
||||||
title: string;
|
title: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileSuite extends Suite {
|
|
||||||
type: 'file';
|
|
||||||
location: Location;
|
|
||||||
parent: Suite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DescribeSuite extends Suite {
|
|
||||||
type: 'describe';
|
|
||||||
location: Location;
|
|
||||||
parent: Suite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProjectSuite extends Suite {
|
|
||||||
type: 'project';
|
|
||||||
location: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RootSuite extends Suite {
|
|
||||||
type: 'root';
|
|
||||||
parent: undefined;
|
|
||||||
location: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A result of a single {@link TestCase} run.
|
* A result of a single {@link TestCase} run.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TeleReporterReceiver, TeleRootSuite } from '@testIsomorphic/teleReceiver';
|
import { TeleReporterReceiver, TeleSuite } from '@testIsomorphic/teleReceiver';
|
||||||
import { statusEx } from '@testIsomorphic/testTree';
|
import { statusEx } from '@testIsomorphic/testTree';
|
||||||
import type { ReporterV2 } from 'playwright/src/reporters/reporterV2';
|
import type { ReporterV2 } from 'playwright/src/reporters/reporterV2';
|
||||||
import type * as reporterTypes from 'playwright/types/testReporter';
|
import type * as reporterTypes from 'playwright/types/testReporter';
|
||||||
|
|
@ -137,7 +137,7 @@ export class TeleSuiteUpdater {
|
||||||
|
|
||||||
asModel(): TestModel {
|
asModel(): TestModel {
|
||||||
return {
|
return {
|
||||||
rootSuite: this.rootSuite || new TeleRootSuite(),
|
rootSuite: this.rootSuite || new TeleSuite('', 'root'),
|
||||||
config: this.config!,
|
config: this.config!,
|
||||||
loadErrors: this.loadErrors,
|
loadErrors: this.loadErrors,
|
||||||
progress: this.progress,
|
progress: this.progress,
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
import '@web/third_party/vscode/codicon.css';
|
import '@web/third_party/vscode/codicon.css';
|
||||||
import '@web/common.css';
|
import '@web/common.css';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { TeleRootSuite } from '@testIsomorphic/teleReceiver';
|
import { TeleSuite } from '@testIsomorphic/teleReceiver';
|
||||||
import { TeleSuiteUpdater } from './teleSuiteUpdater';
|
import { TeleSuiteUpdater } from './teleSuiteUpdater';
|
||||||
import type { Progress } from './uiModeModel';
|
import type { Progress } from './uiModeModel';
|
||||||
import type { TeleTestCase } from '@testIsomorphic/teleReceiver';
|
import type { TeleTestCase } from '@testIsomorphic/teleReceiver';
|
||||||
|
|
@ -226,7 +226,7 @@ export const UIModeView: React.FC<{}> = ({
|
||||||
// Test tree is built from the model and filters.
|
// Test tree is built from the model and filters.
|
||||||
const { testTree } = React.useMemo(() => {
|
const { testTree } = React.useMemo(() => {
|
||||||
if (!testModel)
|
if (!testModel)
|
||||||
return { testTree: new TestTree('', new TeleRootSuite(), [], projectFilters, pathSeparator) };
|
return { testTree: new TestTree('', new TeleSuite('', 'root'), [], projectFilters, pathSeparator) };
|
||||||
const testTree = new TestTree('', testModel.rootSuite, testModel.loadErrors, projectFilters, pathSeparator);
|
const testTree = new TestTree('', testModel.rootSuite, testModel.loadErrors, projectFilters, pathSeparator);
|
||||||
testTree.filterTree(filterText, statusFilters, runningState?.testIds);
|
testTree.filterTree(filterText, statusFilters, runningState?.testIds);
|
||||||
testTree.sortAndPropagateStatus();
|
testTree.sortAndPropagateStatus();
|
||||||
|
|
|
||||||
|
|
@ -600,10 +600,6 @@ class TypesGenerator {
|
||||||
'JSONReportTest',
|
'JSONReportTest',
|
||||||
'JSONReportTestResult',
|
'JSONReportTestResult',
|
||||||
'JSONReportTestStep',
|
'JSONReportTestStep',
|
||||||
'FileSuite',
|
|
||||||
'DescribeSuite',
|
|
||||||
'ProjectSuite',
|
|
||||||
'RootSuite',
|
|
||||||
]),
|
]),
|
||||||
includeExperimental,
|
includeExperimental,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
23
utils/generate_types/overrides-testReporter.d.ts
vendored
23
utils/generate_types/overrides-testReporter.d.ts
vendored
|
|
@ -27,29 +27,6 @@ export interface TestCase {
|
||||||
expectedStatus: TestStatus;
|
expectedStatus: TestStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FileSuite extends Suite {
|
|
||||||
type: 'file';
|
|
||||||
location: Location;
|
|
||||||
parent: Suite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DescribeSuite extends Suite {
|
|
||||||
type: 'describe';
|
|
||||||
location: Location;
|
|
||||||
parent: Suite;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProjectSuite extends Suite {
|
|
||||||
type: 'project';
|
|
||||||
location: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface RootSuite extends Suite {
|
|
||||||
type: 'root';
|
|
||||||
parent: undefined;
|
|
||||||
location: undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TestResult {
|
export interface TestResult {
|
||||||
status: TestStatus;
|
status: TestStatus;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue