chore: move mount implementation to ct-core (#22506)

This commit is contained in:
Pavel Feldman 2023-04-19 15:32:33 -07:00 committed by GitHub
parent e7b9c08833
commit ba8aed9dea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 28 additions and 27 deletions

View File

@ -4,3 +4,4 @@
!LICENSE
!cli.js
!lib/**
!types/**

View File

@ -13,6 +13,7 @@
"license": "Apache-2.0",
"exports": {
"./cli": "./cli.js",
"./lib/mount": "./lib/mount.js",
"./lib/vitePlugin": "./lib/vitePlugin.js"
},
"dependencies": {

View File

@ -14,9 +14,9 @@
* limitations under the License.
*/
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from '../types/test';
import type { Component, JsxComponent, MountOptions } from '../types/experimentalComponent';
import type { ContextReuseMode, FullConfigInternal } from './common/config';
import type { Fixtures, Locator, Page, BrowserContextOptions, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, BrowserContext } from '@playwright/test';
import type { Component, JsxComponent, MountOptions } from '../types/component';
import type { ContextReuseMode, FullConfigInternal } from '../../playwright-test/src/common/config';
let boundCallbacksForMount: Function[] = [];

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig; App: () => JSX.Element }) => Promise<void | JSX.Element>

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -20,7 +20,7 @@
import * as __pwReact from 'react';
import { createRoot as __pwCreateRoot } from 'react-dom/client';
/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('react').FunctionComponent} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig; App: () => JSX.Element }) => Promise<void | JSX.Element>

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -21,7 +21,7 @@
import __pwReact from 'react';
import __pwReactDOM from 'react-dom';
/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('react').FunctionComponent} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */

View File

@ -15,7 +15,7 @@
*/
import { JSXElement } from "solid-js";
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig, App: () => JSXElement }) => Promise<void | JSXElement>

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -20,7 +20,7 @@
import { render as __pwSolidRender, createComponent as __pwSolidCreateComponent } from 'solid-js/web';
import __pwH from 'solid-js/h';
/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {() => import('solid-js').JSX.Element} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */

View File

@ -15,7 +15,7 @@
*/
import type { SvelteComponent } from 'svelte';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig?: HooksConfig }) => Promise<void>

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
import type { SvelteComponent, ComponentProps } from 'svelte/types/runtime';

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -20,7 +20,7 @@
import { detach as __pwDetach, insert as __pwInsert, noop as __pwNoop } from 'svelte/internal';
/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {any} FrameworkComponent */
/** @typedef {import('svelte').SvelteComponent} SvelteComponent */

View File

@ -15,7 +15,7 @@
*/
import type { App, ComponentPublicInstance } from 'vue';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { app: App; hooksConfig?: HooksConfig }) => Promise<void>

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -16,7 +16,7 @@
import { ComponentOptions } from 'vue';
import { CombinedVueInstance, Vue, VueConstructor } from 'vue/types/vue';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: {

View File

@ -23,7 +23,7 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/test/types/experimentalComponent';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {

View File

@ -15,7 +15,7 @@
*/
const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');
const plugin = () => {

View File

@ -20,7 +20,7 @@
import __pwVue, { h as __pwH } from 'vue';
/** @typedef {import('../playwright-test/types/experimentalComponent').Component} Component */
/** @typedef {import('../playwright-ct-core/types/component').Component} Component */
/** @typedef {import('vue').Component} FrameworkComponent */
/** @type {Map<string, FrameworkComponent>} */

View File

@ -22,7 +22,6 @@
"./lib/common/compilationCache": "./lib/common/compilationCache.js",
"./lib/internalsForTest": "./lib/internalsForTest.js",
"./lib/experimentalLoader": "./lib/experimentalLoader.js",
"./lib/mount": "./lib/mount.js",
"./lib/plugins": "./lib/plugins/index.js",
"./lib/util": "./lib/util.js",
"./lib/utilsBundle": "./lib/utilsBundle.js",