Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: do not expose suite load error (#11797)

Pavel Feldman6e2fcc470025
diff --git a/docs/src/test-reporter-api/class-suite.md b/docs/src/test-reporter-api/class-suite.md
index db76fcc25b..b0b3d74c9e 100644
--- a/docs/src/test-reporter-api/class-suite.md
+++ b/docs/src/test-reporter-api/class-suite.md
@@ -24,11 +24,6 @@ Reporter is given a root suite in the [`method: Reporter.onBegin`] method.
Returns the list of all test cases in this suite and its descendants, as opposite to [`property: Suite.tests`].
-## property: Suite.loadError
-- type: <[void]|[TestError]>
-
-For file suites, contains errors that occurred while loading this file.
-
## property: Suite.location
- type: <[void]|[Location]>
diff --git a/packages/playwright-test/src/loader.ts b/packages/playwright-test/src/loader.ts
index 2208d6798e..2e545b9753 100644
--- a/packages/playwright-test/src/loader.ts
+++ b/packages/playwright-test/src/loader.ts
@@ -128,7 +128,7 @@ export class Loader {
} catch (e) {
if (environment === 'worker')
throw e;
- suite.loadError = serializeError(e);
+ suite._loadError = serializeError(e);
} finally {
setCurrentlyLoadingFileSuite(undefined);
}
diff --git a/packages/playwright-test/src/runner.ts b/packages/playwright-test/src/runner.ts
index db003d5b09..9a3e5f2bbd 100644
--- a/packages/playwright-test/src/runner.ts
+++ b/packages/playwright-test/src/runner.ts
@@ -233,8 +233,8 @@ export class Runner {
const preprocessRoot = new Suite('');
for (const file of allTestFiles) {
const fileSuite = await this._loader.loadTestFile(file, 'runner');
- if (fileSuite.loadError)
- fatalErrors.push(fileSuite.loadError);
+ if (fileSuite._loadError)
+ fatalErrors.push(fileSuite._loadError);
preprocessRoot._addSuite(fileSuite);
}
diff --git a/packages/playwright-test/src/test.ts b/packages/playwright-test/src/test.ts
index 441b3a932d..0ba40a7a2f 100644
--- a/packages/playwright-test/src/test.ts
+++ b/packages/playwright-test/src/test.ts
@@ -40,7 +40,6 @@ export type Modifier = {
export class Suite extends Base implements reporterTypes.Suite {
suites: Suite[] = [];
tests: TestCase[] = [];
- loadError?: reporterTypes.TestError;
location?: Location;
parent?: Suite;
_use: FixturesWithLocation[] = [];
@@ -53,6 +52,7 @@ export class Suite extends Base implements reporterTypes.Suite {
_modifiers: Modifier[] = [];
_parallelMode: 'default' | 'serial' | 'parallel' = 'default';
_projectConfig: FullProject | undefined;
+ _loadError?: reporterTypes.TestError;
_addTest(test: TestCase) {
test.parent = this;
diff --git a/packages/playwright-test/types/testReporter.d.ts b/packages/playwright-test/types/testReporter.d.ts
index 0dfe58b4d0..18f92b26fc 100644
--- a/packages/playwright-test/types/testReporter.d.ts
+++ b/packages/playwright-test/types/testReporter.d.ts
@@ -70,10 +70,6 @@ export interface Suite {
* group suite.
*/
title: string;
- /**
- * For file suites, contains errors that occurred while loading this file.
- */
- loadError?: TestError;
/**
* Location in the source where the suite is defined. Missing for root and project suites.
*/
diff --git a/utils/generate_types/overrides-testReporter.d.ts b/utils/generate_types/overrides-testReporter.d.ts
index 9c7a9dafee..af511e8ab1 100644
--- a/utils/generate_types/overrides-testReporter.d.ts
+++ b/utils/generate_types/overrides-testReporter.d.ts
@@ -26,7 +26,6 @@ export interface Location {
export interface Suite {
parent?: Suite;
title: string;
- loadError?: TestError;
location?: Location;
suites: Suite[];
tests: TestCase[];