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`]. 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 ## property: Suite.location
- type: <[void]|[Location]> - type: <[void]|[Location]>

View file

@ -128,7 +128,7 @@ export class Loader {
} catch (e) { } catch (e) {
if (environment === 'worker') if (environment === 'worker')
throw e; throw e;
suite.loadError = serializeError(e); suite._loadError = serializeError(e);
} finally { } finally {
setCurrentlyLoadingFileSuite(undefined); setCurrentlyLoadingFileSuite(undefined);
} }

View file

@ -233,8 +233,8 @@ export class Runner {
const preprocessRoot = new Suite(''); const preprocessRoot = new Suite('');
for (const file of allTestFiles) { for (const file of allTestFiles) {
const fileSuite = await this._loader.loadTestFile(file, 'runner'); const fileSuite = await this._loader.loadTestFile(file, 'runner');
if (fileSuite.loadError) if (fileSuite._loadError)
fatalErrors.push(fileSuite.loadError); fatalErrors.push(fileSuite._loadError);
preprocessRoot._addSuite(fileSuite); preprocessRoot._addSuite(fileSuite);
} }

View file

@ -40,7 +40,6 @@ export type Modifier = {
export class Suite extends Base implements reporterTypes.Suite { export class Suite extends Base implements reporterTypes.Suite {
suites: Suite[] = []; suites: Suite[] = [];
tests: TestCase[] = []; tests: TestCase[] = [];
loadError?: reporterTypes.TestError;
location?: Location; location?: Location;
parent?: Suite; parent?: Suite;
_use: FixturesWithLocation[] = []; _use: FixturesWithLocation[] = [];
@ -53,6 +52,7 @@ export class Suite extends Base implements reporterTypes.Suite {
_modifiers: Modifier[] = []; _modifiers: Modifier[] = [];
_parallelMode: 'default' | 'serial' | 'parallel' = 'default'; _parallelMode: 'default' | 'serial' | 'parallel' = 'default';
_projectConfig: FullProject | undefined; _projectConfig: FullProject | undefined;
_loadError?: reporterTypes.TestError;
_addTest(test: TestCase) { _addTest(test: TestCase) {
test.parent = this; test.parent = this;

View file

@ -70,10 +70,6 @@ export interface Suite {
* group suite. * group suite.
*/ */
title: string; 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. * 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 { export interface Suite {
parent?: Suite; parent?: Suite;
title: string; title: string;
loadError?: TestError;
location?: Location; location?: Location;
suites: Suite[]; suites: Suite[];
tests: TestCase[]; tests: TestCase[];