diff --git a/packages/playwright-ct-react/index.d.ts b/packages/playwright-ct-react/index.d.ts index ef060e7498..63327ee138 100644 --- a/packages/playwright-ct-react/index.d.ts +++ b/packages/playwright-ct-react/index.d.ts @@ -30,7 +30,7 @@ export type PlaywrightTestConfig = Omit Promise); }; }; diff --git a/packages/playwright-ct-solid/index.d.ts b/packages/playwright-ct-solid/index.d.ts index ef060e7498..63327ee138 100644 --- a/packages/playwright-ct-solid/index.d.ts +++ b/packages/playwright-ct-solid/index.d.ts @@ -30,7 +30,7 @@ export type PlaywrightTestConfig = Omit Promise); }; }; diff --git a/packages/playwright-ct-svelte/index.d.ts b/packages/playwright-ct-svelte/index.d.ts index f8fe19f0a4..b879c1eed2 100644 --- a/packages/playwright-ct-svelte/index.d.ts +++ b/packages/playwright-ct-svelte/index.d.ts @@ -31,7 +31,7 @@ export type PlaywrightTestConfig = Omit Promise); }; }; diff --git a/packages/playwright-ct-vue/index.d.ts b/packages/playwright-ct-vue/index.d.ts index 53957dfb73..0309b5e340 100644 --- a/packages/playwright-ct-vue/index.d.ts +++ b/packages/playwright-ct-vue/index.d.ts @@ -30,7 +30,7 @@ export type PlaywrightTestConfig = Omit Promise); }; }; diff --git a/packages/playwright-ct-vue2/index.d.ts b/packages/playwright-ct-vue2/index.d.ts index d3b4a3559f..9b4149dcfa 100644 --- a/packages/playwright-ct-vue2/index.d.ts +++ b/packages/playwright-ct-vue2/index.d.ts @@ -30,7 +30,7 @@ export type PlaywrightTestConfig = Omit Promise); }; }; diff --git a/packages/playwright-test/src/plugins/vitePlugin.ts b/packages/playwright-test/src/plugins/vitePlugin.ts index 40e46e691d..cd72c1bd39 100644 --- a/packages/playwright-test/src/plugins/vitePlugin.ts +++ b/packages/playwright-test/src/plugins/vitePlugin.ts @@ -36,7 +36,7 @@ type CtConfig = BasePlaywrightTestConfig['use'] & { ctPort?: number; ctTemplateDir?: string; ctCacheDir?: string; - ctViteConfig?: InlineConfig; + ctViteConfig?: InlineConfig | (() => Promise); }; 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;