chore: ct vite config async (#20288)
This commit is contained in:
parent
b91bb1af9a
commit
98a0f98577
2
packages/playwright-ct-react/index.d.ts
vendored
2
packages/playwright-ct-react/index.d.ts
vendored
|
|
@ -30,7 +30,7 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
2
packages/playwright-ct-solid/index.d.ts
vendored
2
packages/playwright-ct-solid/index.d.ts
vendored
|
|
@ -30,7 +30,7 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
2
packages/playwright-ct-svelte/index.d.ts
vendored
2
packages/playwright-ct-svelte/index.d.ts
vendored
|
|
@ -31,7 +31,7 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
2
packages/playwright-ct-vue/index.d.ts
vendored
2
packages/playwright-ct-vue/index.d.ts
vendored
|
|
@ -30,7 +30,7 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
2
packages/playwright-ct-vue2/index.d.ts
vendored
2
packages/playwright-ct-vue2/index.d.ts
vendored
|
|
@ -30,7 +30,7 @@ export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ type CtConfig = BasePlaywrightTestConfig['use'] & {
|
|||
ctPort?: number;
|
||||
ctTemplateDir?: string;
|
||||
ctCacheDir?: string;
|
||||
ctViteConfig?: InlineConfig;
|
||||
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
|
||||
};
|
||||
|
||||
const importReactRE = /(^|\n)import\s+(\*\s+as\s+)?React(,|\s+)/;
|
||||
|
|
@ -58,7 +58,7 @@ export function createPlugin(
|
|||
begin: async (suite: Suite) => {
|
||||
const use = config.projects[0].use as CtConfig;
|
||||
const port = use.ctPort || 3100;
|
||||
const viteConfig: InlineConfig = use.ctViteConfig || {};
|
||||
const viteConfig = typeof use.ctViteConfig === 'function' ? await use.ctViteConfig() : (use.ctViteConfig || {});
|
||||
const relativeTemplateDir = use.ctTemplateDir || 'playwright';
|
||||
|
||||
const rootDir = viteConfig.root || configDir;
|
||||
|
|
|
|||
Loading…
Reference in a new issue