From afbd36e92e77e13c292ee8a5cbdbd618ef7120ad Mon Sep 17 00:00:00 2001 From: sand4rt Date: Sun, 25 Dec 2022 14:38:23 +0100 Subject: [PATCH] feat(ct): https --- packages/playwright-test/src/plugins/vitePlugin.ts | 9 +++++---- tests/components/ct-solid/vite.config.ts | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/playwright-test/src/plugins/vitePlugin.ts b/packages/playwright-test/src/plugins/vitePlugin.ts index ebad22e9418d5..67fb896b0ce1a 100644 --- a/packages/playwright-test/src/plugins/vitePlugin.ts +++ b/packages/playwright-test/src/plugins/vitePlugin.ts @@ -94,7 +94,7 @@ export function createPlugin( const sourcesDirty = !buildExists || hasNewComponents || await checkSources(buildInfo); viteConfig.root = rootDir; - viteConfig.preview = { port }; + viteConfig.preview = { port, ...viteConfig.preview }; viteConfig.build = { outDir }; @@ -152,9 +152,10 @@ export function createPlugin( stoppableServer = stoppable(previewServer.httpServer, 0); const isAddressInfo = (x: any): x is AddressInfo => x?.address; const address = previewServer.httpServer.address(); - if (isAddressInfo(address)) - process.env.PLAYWRIGHT_TEST_BASE_URL = `http://localhost:${address.port}`; - + if (isAddressInfo(address)) { + const protocol = viteConfig.preview.https ? 'https:' : 'http:'; + process.env.PLAYWRIGHT_TEST_BASE_URL = `${protocol}//localhost:${address.port}`; + } }, teardown: async () => { diff --git a/tests/components/ct-solid/vite.config.ts b/tests/components/ct-solid/vite.config.ts index 9ff59a172211a..d9f0f6baa718e 100644 --- a/tests/components/ct-solid/vite.config.ts +++ b/tests/components/ct-solid/vite.config.ts @@ -1,6 +1,5 @@ import { defineConfig } from 'vite'; import solidPlugin from 'vite-plugin-solid'; - export default defineConfig({ plugins: [solidPlugin()], server: {