chore: hide plugins again (#14038)
This commit is contained in:
Родитель
04fafcabd8
Коммит
e9378ba5fc
|
@ -318,9 +318,6 @@ The directory for each test can be accessed by [`property: TestInfo.snapshotDir`
|
|||
|
||||
This path will serve as the base directory for each test file snapshot directory. Setting `snapshotDir` to `'snapshots'`, the [`property: TestInfo.snapshotDir`] would resolve to `snapshots/a.spec.js-snapshots`.
|
||||
|
||||
## property: TestConfig.plugins
|
||||
- type: ?<[Array]<[TestPlugin]|[string]>>
|
||||
|
||||
## property: TestConfig.preserveOutput
|
||||
- type: ?<[PreserveOutput]<"always"|"never"|"failures-only">>
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
# class: TestPlugin
|
||||
* langs: js
|
||||
|
||||
## property: TestPlugin.name
|
||||
- type: <[string]>
|
||||
|
||||
## optional async method: TestPlugin.setup
|
||||
### param: TestPlugin.setup.config
|
||||
- `config` <[FullConfig]>
|
||||
|
||||
### param: TestPlugin.setup.configDir
|
||||
- `configDir` <[string]>
|
||||
|
||||
### param: TestPlugin.setup.suite
|
||||
- `suite` <[Suite]>
|
||||
|
||||
## optional async method: TestPlugin.teardown
|
||||
|
||||
## optional property: TestPlugin.fixtures
|
||||
- `fixtures` <[any]>
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { installTransform, setCurrentlyLoadingTestFile } from './transform';
|
||||
import type { Config, Project, ReporterDescription, FullProjectInternal, FullConfigInternal, Fixtures, FixturesWithLocation, TestPlugin } from './types';
|
||||
import type { Config, Project, ReporterDescription, FullProjectInternal, FullConfigInternal, Fixtures, FixturesWithLocation } from './types';
|
||||
import { getPackageJsonPath, mergeObjects, errorWithFile } from './util';
|
||||
import { setCurrentlyLoadingFileSuite } from './globals';
|
||||
import { Suite, type TestCase } from './test';
|
||||
|
@ -123,19 +123,6 @@ export class Loader {
|
|||
if (config.snapshotDir !== undefined)
|
||||
config.snapshotDir = path.resolve(configDir, config.snapshotDir);
|
||||
|
||||
config.plugins = await Promise.all((config.plugins || []).map(async plugin => {
|
||||
if (typeof plugin === 'string')
|
||||
return (await this._requireOrImportDefaultObject(resolveScript(plugin, configDir))) as TestPlugin;
|
||||
return plugin;
|
||||
}));
|
||||
|
||||
for (const plugin of config.plugins || []) {
|
||||
if (!plugin.fixtures)
|
||||
continue;
|
||||
if (typeof plugin.fixtures === 'string')
|
||||
plugin.fixtures = await this._requireOrImportDefaultObject(resolveScript(plugin.fixtures, configDir));
|
||||
}
|
||||
|
||||
this._fullConfig._configDir = configDir;
|
||||
this._fullConfig.rootDir = config.testDir || this._configDir;
|
||||
this._fullConfig._globalOutputDir = takeFirst(config.outputDir, throwawayArtifactsPath, baseFullConfig._globalOutputDir);
|
||||
|
@ -155,7 +142,6 @@ export class Loader {
|
|||
this._fullConfig.updateSnapshots = takeFirst(config.updateSnapshots, baseFullConfig.updateSnapshots);
|
||||
this._fullConfig.workers = takeFirst(config.workers, baseFullConfig.workers);
|
||||
this._fullConfig.webServer = takeFirst(config.webServer, baseFullConfig.webServer);
|
||||
this._fullConfig._plugins = takeFirst(config.plugins, baseFullConfig._plugins);
|
||||
this._fullConfig.metadata = takeFirst(config.metadata, baseFullConfig.metadata);
|
||||
this._fullConfig.projects = (config.projects || [config]).map(p => this._resolveProject(config, this._fullConfig, p, throwawayArtifactsPath));
|
||||
}
|
||||
|
@ -354,16 +340,6 @@ class ProjectSuiteBuilder {
|
|||
if (!this._testPools.has(test)) {
|
||||
let pool = this._buildTestTypePool(test._testType);
|
||||
|
||||
for (const plugin of this._project._fullConfig._plugins) {
|
||||
if (!plugin.fixtures)
|
||||
continue;
|
||||
const pluginFixturesWithLocation: FixturesWithLocation = {
|
||||
fixtures: plugin.fixtures,
|
||||
location: { file: '', line: 0, column: 0 },
|
||||
};
|
||||
pool = new FixturePool([pluginFixturesWithLocation], pool, false);
|
||||
}
|
||||
|
||||
const parents: Suite[] = [];
|
||||
for (let parent: Suite | undefined = test.parent; parent; parent = parent.parent)
|
||||
parents.push(parent);
|
||||
|
@ -653,7 +629,6 @@ export const baseFullConfig: FullConfigInternal = {
|
|||
_globalOutputDir: path.resolve(process.cwd()),
|
||||
_configDir: '',
|
||||
_testGroupsCount: 0,
|
||||
_plugins: [],
|
||||
};
|
||||
|
||||
function resolveReporters(reporters: Config['reporter'], rootDir: string): ReporterDescription[]|undefined {
|
||||
|
|
|
@ -448,7 +448,7 @@ export class Runner {
|
|||
await (await this._loader.loadGlobalHook(config.globalTeardown, 'globalTeardown'))(this._loader.fullConfig());
|
||||
}, result);
|
||||
|
||||
for (const plugin of [...this._plugins, ...config._plugins].reverse()) {
|
||||
for (const plugin of [...this._plugins].reverse()) {
|
||||
await this._runAndReportError(async () => {
|
||||
await plugin.teardown?.();
|
||||
}, result);
|
||||
|
@ -462,7 +462,7 @@ export class Runner {
|
|||
|
||||
// First run the plugins, if plugin is a web server we want it to run before the
|
||||
// config's global setup.
|
||||
for (const plugin of [...this._plugins, ...config._plugins])
|
||||
for (const plugin of this._plugins)
|
||||
await plugin.setup?.(config, config._configDir, rootSuite);
|
||||
|
||||
// The do global setup.
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import type { Fixtures, TestError, Project, TestPlugin } from '../types/test';
|
||||
import type { Fixtures, TestError, Project } from '../types/test';
|
||||
import type { Location } from '../types/testReporter';
|
||||
import type { FullConfig as FullConfigPublic, FullProject as FullProjectPublic } from './types';
|
||||
export * from '../types/test';
|
||||
|
@ -44,7 +44,6 @@ export interface FullConfigInternal extends FullConfigPublic {
|
|||
_globalOutputDir: string;
|
||||
_configDir: string;
|
||||
_testGroupsCount: number;
|
||||
_plugins: TestPlugin[];
|
||||
|
||||
// Overrides the public field.
|
||||
projects: FullProjectInternal[];
|
||||
|
|
|
@ -366,22 +366,6 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
|
|||
|
||||
type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export interface TestPlugin {
|
||||
fixtures?: Fixtures;
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* @param config
|
||||
* @param configDir
|
||||
* @param suite
|
||||
*/
|
||||
setup?(config: FullConfig, configDir: string, suite: Suite): Promise<void>;
|
||||
|
||||
teardown?(): Promise<void>;}
|
||||
|
||||
/**
|
||||
* Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or
|
||||
* `testDir`. These options are described in the [TestConfig] object in the [configuration file](https://playwright.dev/docs/test-configuration).
|
||||
|
@ -475,7 +459,6 @@ interface TestConfig {
|
|||
*
|
||||
*/
|
||||
webServer?: TestConfigWebServer;
|
||||
plugins?: TestPlugin[],
|
||||
/**
|
||||
* Configuration for the `expect` assertion library. Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).
|
||||
*
|
||||
|
|
|
@ -16765,22 +16765,6 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
|
|||
|
||||
type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export interface TestPlugin {
|
||||
fixtures?: Fixtures;
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* @param config
|
||||
* @param configDir
|
||||
* @param suite
|
||||
*/
|
||||
setup?(config: FullConfig, configDir: string, suite: Suite): Promise<void>;
|
||||
|
||||
teardown?(): Promise<void>;}
|
||||
|
||||
/**
|
||||
* Playwright Test provides many options to configure how your tests are collected and executed, for example `timeout` or
|
||||
* `testDir`. These options are described in the [TestConfig] object in the [configuration file](https://playwright.dev/docs/test-configuration).
|
||||
|
@ -16874,7 +16858,6 @@ interface TestConfig {
|
|||
*
|
||||
*/
|
||||
webServer?: TestConfigWebServer;
|
||||
plugins?: TestPlugin[],
|
||||
/**
|
||||
* Configuration for the `expect` assertion library. Learn more about [various timeouts](https://playwright.dev/docs/test-timeouts).
|
||||
*
|
||||
|
|
|
@ -56,14 +56,9 @@ export interface FullProject<TestArgs = {}, WorkerArgs = {}> {
|
|||
|
||||
type LiteralUnion<T extends U, U = string> = T | (U & { zz_IGNORE_ME?: never });
|
||||
|
||||
export interface TestPlugin {
|
||||
fixtures?: Fixtures;
|
||||
}
|
||||
|
||||
interface TestConfig {
|
||||
reporter?: LiteralUnion<'list'|'dot'|'line'|'github'|'json'|'junit'|'null'|'html', string> | ReporterDescription[];
|
||||
webServer?: TestConfigWebServer;
|
||||
plugins?: TestPlugin[],
|
||||
}
|
||||
|
||||
export interface Config<TestArgs = {}, WorkerArgs = {}> extends TestConfig {
|
||||
|
|
Загрузка…
Ссылка в новой задаче