From 41c15cb1767b8bc9cae54d608dccd0c3058c14c9 Mon Sep 17 00:00:00 2001 From: Pavel Feldman Date: Tue, 23 Jan 2024 09:40:05 -0800 Subject: [PATCH] chore: move vite root dir into template folder (#29081) --- packages/html-reporter/playwright/index.html | 2 +- packages/playwright-ct-core/src/vitePlugin.ts | 4 ++-- .../ct-svelte-vite/{ => playwright}/svelte.config.js | 0 tests/playwright-test/playwright.ct-build.spec.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename tests/components/ct-svelte-vite/{ => playwright}/svelte.config.js (100%) diff --git a/packages/html-reporter/playwright/index.html b/packages/html-reporter/playwright/index.html index 9bba58cfa3..b18a1e9c7d 100644 --- a/packages/html-reporter/playwright/index.html +++ b/packages/html-reporter/playwright/index.html @@ -24,6 +24,6 @@
- + diff --git a/packages/playwright-ct-core/src/vitePlugin.ts b/packages/playwright-ct-core/src/vitePlugin.ts index 147278587b..ca012c272f 100644 --- a/packages/playwright-ct-core/src/vitePlugin.ts +++ b/packages/playwright-ct-core/src/vitePlugin.ts @@ -76,8 +76,9 @@ export function createPlugin( // Compose base config from the playwright config only. const baseConfig: InlineConfig = { - root: configDir, + root: templateDir, configFile: false, + publicDir: path.join(configDir, 'public'), define: { __VUE_PROD_DEVTOOLS__: true, }, @@ -189,7 +190,6 @@ export function createPlugin( if (sourcesDirty) { log('build'); await build(finalConfig); - await fs.promises.rename(`${finalConfig.build.outDir}/${relativeTemplateDir}/index.html`, `${finalConfig.build.outDir}/index.html`); buildInfo.deps = Object.fromEntries(depsCollector.entries()); } diff --git a/tests/components/ct-svelte-vite/svelte.config.js b/tests/components/ct-svelte-vite/playwright/svelte.config.js similarity index 100% rename from tests/components/ct-svelte-vite/svelte.config.js rename to tests/components/ct-svelte-vite/playwright/svelte.config.js diff --git a/tests/playwright-test/playwright.ct-build.spec.ts b/tests/playwright-test/playwright.ct-build.spec.ts index a9421c39aa..6fd4f6d474 100644 --- a/tests/playwright-test/playwright.ct-build.spec.ts +++ b/tests/playwright-test/playwright.ct-build.spec.ts @@ -39,7 +39,7 @@ test('should work with the empty component list', async ({ runInlineTest }, test expect(result.passed).toBe(1); const output = result.output; expect(output).toContain('transforming...'); - expect(output.replace(/\\+/g, '/')).toContain('playwright/.cache/playwright/index.html'); + expect(output.replace(/\\+/g, '/')).toContain('.cache/index.html'); const metainfo = JSON.parse(fs.readFileSync(testInfo.outputPath('playwright/.cache/metainfo.json'), 'utf-8')); expect(metainfo.version).toEqual(require('playwright-core/package.json').version);