From 734f49bc3067fe2a11194a660219ce2882d4007f Mon Sep 17 00:00:00 2001 From: Philip Weber Date: Fri, 8 Jul 2022 20:57:29 +0200 Subject: [PATCH 1/9] [fix] Use vite preview port in playwright template --- .../shared/+playwright+typescript/playwright.config.ts | 2 +- .../shared/+playwright-typescript/playwright.config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts b/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts index 87c293e5a113..6ad3a7faa279 100644 --- a/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts +++ b/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts @@ -3,7 +3,7 @@ import type { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { webServer: { command: 'npm run build && npm run preview', - port: 3000 + port: 4173 } }; diff --git a/packages/create-svelte/shared/+playwright-typescript/playwright.config.js b/packages/create-svelte/shared/+playwright-typescript/playwright.config.js index 448008a2f186..ea17df6ed35d 100644 --- a/packages/create-svelte/shared/+playwright-typescript/playwright.config.js +++ b/packages/create-svelte/shared/+playwright-typescript/playwright.config.js @@ -2,7 +2,7 @@ const config = { webServer: { command: 'npm run build && npm run preview', - port: 3000 + port: 4173 } }; From 7dd757b805bc82152f23297237e25c6fb78c3da7 Mon Sep 17 00:00:00 2001 From: Philip Weber Date: Fri, 8 Jul 2022 21:19:14 +0200 Subject: [PATCH 2/9] Use `vite` ports for tests --- packages/kit/test/apps/basics/test/test.js | 13 ++++++++++--- packages/kit/test/utils.js | 8 ++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index 07a25fc9f6e5..da90032b3e8c 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -1638,7 +1638,10 @@ test.describe('Load', () => { } }); - test('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => { + test.only('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => { + const DEV_SERVER_PORT = 3000; + const PREVIEW_SERVER_PORT = 4173; + if (javaScriptEnabled && process.env.DEV) { const warnings = []; @@ -1652,7 +1655,9 @@ test.describe('Load', () => { expect(await page.textContent('h1')).toBe('42'); expect(warnings).toContain( - 'Loading http://localhost:3000/load/window-fetch/data.json using `window.fetch`. For best results, use the `fetch` that is passed to your `load` function: https://kit.svelte.dev/docs/loading#input-fetch' + `Loading http://localhost:${ + process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT + }/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` ); warnings.length = 0; @@ -1661,7 +1666,9 @@ test.describe('Load', () => { expect(await page.textContent('h1')).toBe('42'); expect(warnings).not.toContain( - 'Loading http://localhost:3000/load/window-fetch/data.json using `window.fetch`. For best results, use the `fetch` that is passed to your `load` function: https://kit.svelte.dev/docs/loading#input-fetch' + `Loading http://localhost:${ + process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT + }/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` ); } }); diff --git a/packages/kit/test/utils.js b/packages/kit/test/utils.js index 364a8ae41a52..f0e969ae1b05 100644 --- a/packages/kit/test/utils.js +++ b/packages/kit/test/utils.js @@ -144,18 +144,14 @@ if (!test_browser_device) { ); } -const port = 3000; - /** @type {import('@playwright/test').PlaywrightTestConfig} */ export const config = { forbidOnly: !!process.env.CI, // generous timeouts on CI timeout: process.env.CI ? 45000 : 15000, webServer: { - command: process.env.DEV - ? `npm run dev -- --port ${port}` - : `npm run build && npm run preview -- --port ${port}`, - port + command: process.env.DEV ? 'npm run dev' : 'npm run build && npm run preview', + port: process.env.DEV ? 3000 : 4173 }, retries: process.env.CI ? 5 : 0, projects: [ From a1ea008aeee33ec87afd2c0ea485b999638df923 Mon Sep 17 00:00:00 2001 From: Philip Weber Date: Fri, 8 Jul 2022 21:23:11 +0200 Subject: [PATCH 3/9] Add changeset --- .changeset/lemon-elephants-chew.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/lemon-elephants-chew.md diff --git a/.changeset/lemon-elephants-chew.md b/.changeset/lemon-elephants-chew.md new file mode 100644 index 000000000000..1f1c94910db9 --- /dev/null +++ b/.changeset/lemon-elephants-chew.md @@ -0,0 +1,7 @@ +--- +'create-svelte': patch +'test-basics': patch +'@sveltejs/kit': patch +--- + +Align `playwright` server ports with `vite` preview server port From bc1acf89268ae0edc0650f34979fbc2b44269eb6 Mon Sep 17 00:00:00 2001 From: Philip Weber Date: Fri, 8 Jul 2022 21:34:50 +0200 Subject: [PATCH 4/9] Fix lint --- packages/kit/test/apps/basics/test/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index da90032b3e8c..4596d01eee56 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -1638,7 +1638,7 @@ test.describe('Load', () => { } }); - test.only('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => { + test('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => { const DEV_SERVER_PORT = 3000; const PREVIEW_SERVER_PORT = 4173; From 8ab6fdb25d85fc85bce72914669a872f3a283c8f Mon Sep 17 00:00:00 2001 From: Philip Weber <2432570+philip-weber@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:37:09 +0200 Subject: [PATCH 5/9] Update packages/kit/test/apps/basics/test/test.js Co-authored-by: Rich Harris --- packages/kit/test/apps/basics/test/test.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index 4596d01eee56..9e8f7d8d0b70 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -1639,8 +1639,7 @@ test.describe('Load', () => { }); test('using window.fetch causes a warning', async ({ page, javaScriptEnabled }) => { - const DEV_SERVER_PORT = 3000; - const PREVIEW_SERVER_PORT = 4173; + const port = process.env.DEV ? 3000 : 4173; if (javaScriptEnabled && process.env.DEV) { const warnings = []; From 73d03df4bb72b59dae564652522f9911deba7ce7 Mon Sep 17 00:00:00 2001 From: Philip Weber <2432570+philip-weber@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:37:19 +0200 Subject: [PATCH 6/9] Update .changeset/lemon-elephants-chew.md Co-authored-by: Rich Harris --- .changeset/lemon-elephants-chew.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/.changeset/lemon-elephants-chew.md b/.changeset/lemon-elephants-chew.md index 1f1c94910db9..36ab0cb20a6d 100644 --- a/.changeset/lemon-elephants-chew.md +++ b/.changeset/lemon-elephants-chew.md @@ -1,6 +1,4 @@ --- -'create-svelte': patch -'test-basics': patch '@sveltejs/kit': patch --- From c15d87a81efe9f1f127abc062d16d2f853be5dc4 Mon Sep 17 00:00:00 2001 From: Philip Weber <2432570+philip-weber@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:37:27 +0200 Subject: [PATCH 7/9] Update packages/kit/test/apps/basics/test/test.js Co-authored-by: Rich Harris --- packages/kit/test/apps/basics/test/test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index 9e8f7d8d0b70..6c9c6875c899 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -1654,9 +1654,7 @@ test.describe('Load', () => { expect(await page.textContent('h1')).toBe('42'); expect(warnings).toContain( - `Loading http://localhost:${ - process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT - }/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` + `Loading http://localhost:${port}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` ); warnings.length = 0; From e0549db14d94bf9bdbdd288dbe76cb1566560fec Mon Sep 17 00:00:00 2001 From: Philip Weber <2432570+philip-weber@users.noreply.github.com> Date: Fri, 8 Jul 2022 21:37:37 +0200 Subject: [PATCH 8/9] Update packages/kit/test/apps/basics/test/test.js Co-authored-by: Rich Harris --- packages/kit/test/apps/basics/test/test.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/kit/test/apps/basics/test/test.js b/packages/kit/test/apps/basics/test/test.js index 6c9c6875c899..f173ee6fe626 100644 --- a/packages/kit/test/apps/basics/test/test.js +++ b/packages/kit/test/apps/basics/test/test.js @@ -1663,9 +1663,7 @@ test.describe('Load', () => { expect(await page.textContent('h1')).toBe('42'); expect(warnings).not.toContain( - `Loading http://localhost:${ - process.env.DEV ? DEV_SERVER_PORT : PREVIEW_SERVER_PORT - }/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` + `Loading http://localhost:${port}/load/window-fetch/data.json using \`window.fetch\`. For best results, use the \`fetch\` that is passed to your \`load\` function: https://kit.svelte.dev/docs/loading#input-fetch` ); } }); From 7487461eb6587fa585d173a8ea4fa3352d2cfaa1 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Fri, 8 Jul 2022 16:13:18 -0400 Subject: [PATCH 9/9] on second thoughts, no changeset needed --- .changeset/lemon-elephants-chew.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .changeset/lemon-elephants-chew.md diff --git a/.changeset/lemon-elephants-chew.md b/.changeset/lemon-elephants-chew.md deleted file mode 100644 index 36ab0cb20a6d..000000000000 --- a/.changeset/lemon-elephants-chew.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@sveltejs/kit': patch ---- - -Align `playwright` server ports with `vite` preview server port