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

This commit is contained in:
Pavel Feldman 2022-02-01 15:34:16 -08:00 committed by GitHub
parent 011d743f90
commit 6e2fcc4700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 14 deletions

View File

@ -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]>

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;

View File

@ -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.
*/

View File

@ -26,7 +26,6 @@ export interface Location {
export interface Suite {
parent?: Suite;
title: string;
loadError?: TestError;
location?: Location;
suites: Suite[];
tests: TestCase[];