Repository: sveltejs/kit (js)

Issue:
Remove `format: 'cjs'` option from `builder.generateManifest(...)`
### Describe the problem

`builder.generateManifest(...)` takes a `format` option which can be either `esm` or `cjs`. The `cjs` option is there because certain adapters needed it at one point. That's no longer the case, at least for the official adapters.

### Describe the proposed solution

In the spirit of removing as much technical debt as possible ahead of 1.0, we should remove the `cjs` option. We should probably do a quick survey of community adapters before ploughing ahead though.

### Alternatives considered

Leave it be

### Importance

nice to have

### Additional Information

_No response_

Pull request description:
remove `format` option from `generateManifest(...)`
closes #7798. I haven't yet checked community adapters to make sure no-one is using this

### Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
- [x] It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
- [x] This message body should clearly illustrate what problems it solves.
- [ ] Ideally, include a test that fails without this PR but passes with it.

### Tests
- [x] Run the tests with `pnpm test` and lint the project with `pnpm lint` and `pnpm check`

### Changesets
- [x] If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running `pnpm changeset` and following the prompts. All changesets should be `patch` until SvelteKit 1.0


Patch:
diff --git a/.changeset/chilled-drinks-hug.md b/.changeset/chilled-drinks-hug.md
new file mode 100644
index 000000000..a7a2d220a
--- /dev/null
+++ b/.changeset/chilled-drinks-hug.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Make touchstart listener passive
diff --git a/.changeset/dirty-teachers-hug.md b/.changeset/dirty-teachers-hug.md
new file mode 100644
index 000000000..97aacb1d7
--- /dev/null
+++ b/.changeset/dirty-teachers-hug.md
@@ -0,0 +1,5 @@
+---
+'create-svelte': patch
+---
+
+Added the option to add Vitest to new projects
diff --git a/.changeset/itchy-beers-suffer.md b/.changeset/itchy-beers-suffer.md
new file mode 100644
index 000000000..2681994a5
--- /dev/null
+++ b/.changeset/itchy-beers-suffer.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+Make console.warn wrapper named rather than anonymous
diff --git a/.changeset/pre.json b/.changeset/pre.json
index 8a1747b83..324954c44 100644
--- a/.changeset/pre.json
+++ b/.changeset/pre.json
@@ -134,6 +134,7 @@
     "brown-pens-glow",
     "brown-seas-sort",
     "calm-pans-peel",
+    "calm-peaches-enjoy",
     "calm-pens-prove",
     "calm-pots-turn",
     "calm-ravens-tell",
@@ -152,6 +153,7 @@
     "chilled-bees-develop",
     "chilled-books-dress",
     "chilled-clouds-move",
+    "chilled-drinks-hug",
     "chilled-kiwis-drop",
     "chilled-laws-battle",
     "chilled-moons-sniff",
@@ -249,6 +251,7 @@
     "dirty-bikes-join",
     "dirty-candles-peel",
     "dirty-ligers-protect",
+    "dirty-teachers-hug",
     "dry-baboons-turn",
     "dry-cars-dance",
     "dry-jokes-explain",
@@ -497,6 +500,7 @@
     "grumpy-days-compete",
     "grumpy-eyes-destroy",
     "grumpy-jobs-poke",
+    "grumpy-maps-complain",
     "grumpy-onions-applaud",
     "grumpy-panthers-mate",
     "grumpy-poets-try",
@@ -580,6 +584,7 @@
     "itchy-ants-explode",
     "itchy-beds-drop",
     "itchy-beers-burn",
+    "itchy-beers-suffer",
     "itchy-birds-admire",
     "itchy-days-matter",
     "itchy-days-wonder",
diff --git a/.changeset/shy-queens-wash.md b/.changeset/shy-queens-wash.md
new file mode 100644
index 000000000..65c549e2b
--- /dev/null
+++ b/.changeset/shy-queens-wash.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+[breaking] remove `format` option from `generateManifest(...)`
diff --git a/packages/create-svelte/CHANGELOG.md b/packages/create-svelte/CHANGELOG.md
index 79e2ecb53..f3f30fbf0 100644
--- a/packages/create-svelte/CHANGELOG.md
+++ b/packages/create-svelte/CHANGELOG.md
@@ -1,5 +1,11 @@
 # create-svelte
 
+## 2.0.0-next.193
+
+### Patch Changes
+
+- Added the option to add Vitest to new projects ([#5708](https://github.com/sveltejs/kit/pull/5708))
+
 ## 2.0.0-next.192
 
 ### Patch Changes
diff --git a/packages/create-svelte/bin.js b/packages/create-svelte/bin.js
index 94c3dc529..32db8d6e0 100755
--- a/packages/create-svelte/bin.js
+++ b/packages/create-svelte/bin.js
@@ -110,6 +110,14 @@ async function main() {
 					initial: false,
 					active: 'Yes',
 					inactive: 'No'
+				},
+				{
+					type: 'toggle',
+					name: 'vitest',
+					message: 'Add Vitest for unit testing?',
+					initial: false,
+					active: 'Yes',
+					inactive: 'No'
 				}
 			],
 			{
@@ -150,6 +158,11 @@ async function main() {
 		console.log(cyan('  https://playwright.dev'));
 	}
 
+	if (options.vitest) {
+		console.log(bold('✔ Vitest'));
+		console.log(cyan('  https://vitest.dev'));
+	}
+
 	console.log('\nInstall community-maintained integrations:');
 	console.log(cyan('  https://github.com/svelte-add/svelte-adders'));
 
diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json
index d21fce66a..c7f25d5ab 100644
--- a/packages/create-svelte/package.json
+++ b/packages/create-svelte/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "create-svelte",
-	"version": "2.0.0-next.192",
+	"version": "2.0.0-next.193",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/create-svelte/scripts/update-template-repo-contents.js b/packages/create-svelte/scripts/update-template-repo-contents.js
index 60f3cbee8..1eb7a07dc 100644
--- a/packages/create-svelte/scripts/update-template-repo-contents.js
+++ b/packages/create-svelte/scripts/update-template-repo-contents.js
@@ -19,7 +19,8 @@ await create(repo, {
 	eslint: false,
 	types: 'checkjs',
 	prettier: true,
-	playwright: false
+	playwright: false,
+	vitest: false
 });
 
 // Remove the Sverdle from the template because it doesn't work within Stackblitz (cookies not set)
diff --git a/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts b/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts
index 6ad3a7faa..2d5a65aee 100644
--- a/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts
+++ b/packages/create-svelte/shared/+playwright+typescript/playwright.config.ts
@@ -4,7 +4,8 @@ const config: PlaywrightTestConfig = {
 	webServer: {
 		command: 'npm run build && npm run preview',
 		port: 4173
-	}
+	},
+	testMatch: 'tests/**/.*(test|spec).(js|ts)'
 };
 
 export default config;
diff --git a/packages/create-svelte/shared/+playwright-typescript/playwright.config.js b/packages/create-svelte/shared/+playwright-typescript/playwright.config.js
index ea17df6ed..99422c1de 100644
--- a/packages/create-svelte/shared/+playwright-typescript/playwright.config.js
+++ b/packages/create-svelte/shared/+playwright-typescript/playwright.config.js
@@ -3,7 +3,8 @@ const config = {
 	webServer: {
 		command: 'npm run build && npm run preview',
 		port: 4173
-	}
+	},
+	testMatch: 'tests/**/.*(test|spec).(js|ts)'
 };
 
 export default config;
diff --git a/packages/create-svelte/shared/vite.config.ts b/packages/create-svelte/shared/vite.config.js
similarity index 67%
rename from packages/create-svelte/shared/vite.config.ts
rename to packages/create-svelte/shared/vite.config.js
index 60ef89c74..874705053 100644
--- a/packages/create-svelte/shared/vite.config.ts
+++ b/packages/create-svelte/shared/vite.config.js
@@ -1,8 +1,7 @@
 import { sveltekit } from '@sveltejs/kit/vite';
-import type { UserConfig } from 'vite';
 
 /** @type {import('vite').UserConfig} */
-const config: UserConfig = {
+const config = {
 	plugins: [sveltekit()]
 };
 
diff --git a/packages/create-svelte/templates/default/src/routes/sverdle/+page.server.ts b/packages/create-svelte/templates/default/src/routes/sverdle/+page.server.ts
index b95dbde04..9e8075993 100644
--- a/packages/create-svelte/templates/default/src/routes/sverdle/+page.server.ts
+++ b/packages/create-svelte/templates/default/src/routes/sverdle/+page.server.ts
@@ -1,5 +1,5 @@
 import { invalid } from '@sveltejs/kit';
-import { words, allowed } from './words.server';
+import { Game } from './game';
 import type { PageServerLoad, Actions } from './$types';
 
 /** @type {import('./$types').PageServerLoad} */
@@ -69,79 +69,3 @@ export const actions: Actions = {
 		cookies.delete('sverdle');
 	}
 };
-
-class Game {
-	index: number;
-	guesses: string[];
-	answers: string[];
-	answer: string;
-
-	/**
-	 * Create a game object from the player's cookie, or initialise a new game
-	 * @param {string | undefined} serialized
-	 */
-	constructor(serialized: string | undefined) {
-		if (serialized) {
-			const [index, guesses, answers] = serialized.split('-');
-
-			this.index = +index;
-			this.guesses = guesses ? guesses.split(' ') : [];
-			this.answers = answers ? answers.split(' ') : [];
-		} else {
-			this.index = Math.floor(Math.random() * words.length);
-			this.guesses = ['', '', '', '', '', ''];
-			this.answers = /** @type {string[]} */ [] /***/;
-		}
-
-		this.answer = words[this.index];
-	}
-
-	/**
-	 * Update game state based on a guess of a five-letter word. Returns
-	 * true if the guess was valid, false otherwise
-	 * @param {string[]} letters
-	 */
-	enter(letters: string[]) {
-		const word = letters.join('');
-		const valid = allowed.has(word);
-
-		if (!valid) return false;
-
-		this.guesses[this.answers.length] = word;
-
-		const available = Array.from(this.answer);
-		const answer = Array(5).fill('_');
-
-		// first, find exact matches
-		for (let i = 0; i < 5; i += 1) {
-			if (letters[i] === available[i]) {
-				answer[i] = 'x';
-				available[i] = ' ';
-			}
-		}
-
-		// then find close matches (this has to happen
-		// in a second step, otherwise an early close
-		// match can prevent a later exact match)
-		for (let i = 0; i < 5; i += 1) {
-			if (answer[i] === '_') {
-				const index = available.indexOf(letters[i]);
-				if (index !== -1) {
-					answer[i] = 'c';
-					available[index] = ' ';
-				}
-			}
-		}
-
-		this.answers.push(answer.join(''));
-
-		return true;
-	}
-
-	/**
-	 * Serialize game state so it can be set as a cookie
-	 */
-	toString() {
-		return `${this.index}-${this.guesses.join(' ')}-${this.answers.join(' ')}`;
-	}
-}
diff --git a/packages/create-svelte/templates/default/src/routes/sverdle/game.ts b/packages/create-svelte/templates/default/src/routes/sverdle/game.ts
new file mode 100644
index 000000000..d5cbe932e
--- /dev/null
+++ b/packages/create-svelte/templates/default/src/routes/sverdle/game.ts
@@ -0,0 +1,77 @@
+import { words, allowed } from './words.server';
+
+export class Game {
+	index: number;
+	guesses: string[];
+	answers: string[];
+	answer: string;
+
+	/**
+	 * Create a game object from the player's cookie, or initialise a new game
+	 * @param {string | undefined} serialized
+	 */
+	constructor(serialized: string | undefined = undefined) {
+		if (serialized) {
+			const [index, guesses, answers] = serialized.split('-');
+
+			this.index = +index;
+			this.guesses = guesses ? guesses.split(' ') : [];
+			this.answers = answers ? answers.split(' ') : [];
+		} else {
+			this.index = Math.floor(Math.random() * words.length);
+			this.guesses = ['', '', '', '', '', ''];
+			this.answers = /** @type {string[]} */ [] /***/;
+		}
+
+		this.answer = words[this.index];
+	}
+
+	/**
+	 * Update game state based on a guess of a five-letter word. Returns
+	 * true if the guess was valid, false otherwise
+	 * @param {string[]} letters
+	 */
+	enter(letters: string[]) {
+		const word = letters.join('');
+		const valid = allowed.has(word);
+
+		if (!valid) return false;
+
+		this.guesses[this.answers.length] = word;
+
+		const available = Array.from(this.answer);
+		const answer = Array(5).fill('_');
+
+		// first, find exact matches
+		for (let i = 0; i < 5; i += 1) {
+			if (letters[i] === available[i]) {
+				answer[i] = 'x';
+				available[i] = ' ';
+			}
+		}
+
+		// then find close matches (this has to happen
+		// in a second step, otherwise an early close
+		// match can prevent a later exact match)
+		for (let i = 0; i < 5; i += 1) {
+			if (answer[i] === '_') {
+				const index = available.indexOf(letters[i]);
+				if (index !== -1) {
+					answer[i] = 'c';
+					available[index] = ' ';
+				}
+			}
+		}
+
+		this.answers.push(answer.join(''));
+
+		return true;
+	}
+
+	/**
+	 * Serialize game state so it can be set as a cookie
+	 */
+	toString() {
+		return `${this.index}-${this.guesses.join(' ')}-${this.answers.join(' ')}`;
+	}
+}
diff --git a/packages/create-svelte/types/internal.d.ts b/packages/create-svelte/types/internal.d.ts
index 857180765..612d1cd3c 100644
--- a/packages/create-svelte/types/internal.d.ts
+++ b/packages/create-svelte/types/internal.d.ts
@@ -5,6 +5,7 @@ export type Options = {
 	prettier: boolean;
 	eslint: boolean;
 	playwright: boolean;
+	vitest: boolean;
 };
 
 export type File = {
@@ -18,6 +19,7 @@ export type Condition =
 	| 'typescript'
 	| 'checkjs'
 	| 'playwright'
+	| 'vitest'
 	| 'skeleton'
 	| 'default'
 	| 'skeletonlib';
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index b0149e9ae..ec21aff6d 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,17 @@
 # @sveltejs/kit
 
+## 1.0.0-next.562
+
+### Patch Changes
+
+- [fix] handle redirects in handle hook while processing data request ([#7797](https://github.com/sveltejs/kit/pull/7797))
+
+- Make touchstart listener passive ([#7818](https://github.com/sveltejs/kit/pull/7818))
+
+- [breaking] remove `getStaticDirectory()` from builder API ([#7809](https://github.com/sveltejs/kit/pull/7809))
+
+- Make console.warn wrapper named rather than anonymous ([#7811](https://github.com/sveltejs/kit/pull/7811))
+
 ## 1.0.0-next.561
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index 1285e6d09..284e433f0 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,6 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.0.0-next.561",
+	"version": "1.0.0-next.562",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/core/generate_manifest/index.js b/packages/kit/src/core/generate_manifest/index.js
index a77685b96..c4ace9567 100644
--- a/packages/kit/src/core/generate_manifest/index.js
+++ b/packages/kit/src/core/generate_manifest/index.js
@@ -11,10 +11,9 @@ import { join_relative } from '../../utils/filesystem.js';
  *   build_data: import('types').BuildData;
  *   relative_path: string;
  *   routes: import('types').RouteData[];
- *   format?: 'esm' | 'cjs'
  * }} opts
  */
-export function generate_manifest({ build_data, relative_path, routes, format = 'esm' }) {
+export function generate_manifest({ build_data, relative_path, routes }) {
 	/**
 	 * @type {Map<any, number>} The new index of each node in the filtered nodes array
 	 */
@@ -55,13 +54,7 @@ export function generate_manifest({ build_data, relative_path, routes, format =
 	});
 
 	/** @type {(path: string) => string} */
-	const load =
-		format === 'esm'
-			? (path) => `import('${path}')`
-			: (path) => `Promise.resolve().then(() => require('${path}'))`;
-
-	/** @type {(path: string) => string} */
-	const loader = (path) => `() => ${load(path)}`;
+	const loader = (path) => `() => import('${path}')`;
 
 	const assets = build_data.manifest_data.assets.map((asset) => asset.file);
 	if (build_data.service_worker) {
@@ -115,7 +108,7 @@ export function generate_manifest({ build_data, relative_path, routes, format =
 				}).filter(Boolean).join(',\n\t\t\t\t')}
 			],
 			matchers: async () => {
-				${Array.from(matchers).map(type => `const { match: ${type} } = await ${load(join_relative(relative_path, `/entries/matchers/${type}.js`))}`).join('\n\t\t\t\t')}
+				${Array.from(matchers).map(type => `const { match: ${type} } = await import ('${(join_relative(relative_path, `/entries/matchers/${type}.js`))}')`).join('\n\t\t\t\t')}
 				return { ${Array.from(matchers).join(', ')} };
 			}
 		}
diff --git a/packages/kit/src/runtime/client/client.js b/packages/kit/src/runtime/client/client.js
index 7d05d6490..7d8c8ea94 100644
--- a/packages/kit/src/runtime/client/client.js
+++ b/packages/kit/src/runtime/client/client.js
@@ -1385,7 +1385,7 @@ export function create_client({ target, base }) {
 				}, 20);
 			};
 
-			target.addEventListener('touchstart', trigger_prefetch);
+			target.addEventListener('touchstart', trigger_prefetch, { passive: true });
 			target.addEventListener('mousemove', handle_mousemove);
 			target.addEventListener('sveltekit:trigger_prefetch', trigger_prefetch);
 
@@ -1717,8 +1717,8 @@ function reset_focus() {
 
 if (__SVELTEKIT_DEV__) {
 	// Nasty hack to silence harmless warnings the user can do nothing about
-	const warn = console.warn;
-	console.warn = (...args) => {
+	const console_warn = console.warn;
+	console.warn = function warn(...args) {
 		if (
 			args.length === 1 &&
 			/<(Layout|Page)(_[\w$]+)?> was created (with unknown|without expected) prop '(data|form)'/.test(
@@ -1727,6 +1727,6 @@ if (__SVELTEKIT_DEV__) {
 		) {
 			return;
 		}
-		warn(...args);
+		console_warn(...args);
 	};
 }
diff --git a/packages/kit/types/index.d.ts b/packages/kit/types/index.d.ts
index ea7672e19..9ad10236d 100644
--- a/packages/kit/types/index.d.ts
+++ b/packages/kit/types/index.d.ts
@@ -72,7 +72,7 @@ export interface Builder {
 	 */
 	createEntries(fn: (route: RouteDefinition) => AdapterEntry): Promise<void>;
 
-	generateManifest(opts: { relativePath: string; format?: 'esm' | 'cjs' }): string;
+	generateManifest(opts: { relativePath: string }): string;
 
 	getBuildDirectory(name: string): string;
 	getClientDirectory(): string;
diff --git a/packages/kit/types/private.d.ts b/packages/kit/types/private.d.ts
index f4742392c..397687ae0 100644
--- a/packages/kit/types/private.d.ts
+++ b/packages/kit/types/private.d.ts
@@ -21,9 +21,7 @@ export interface AdapterEntry {
 	 * A function that is invoked once the entry has been created. This is where you
 	 * should write the function to the filesystem and generate redirect manifests.
 	 */
-	complete(entry: {
-		generateManifest(opts: { relativePath: string; format?: 'esm' | 'cjs' }): string;
-	}): MaybePromise<void>;
+	complete(entry: { generateManifest(opts: { relativePath: string }): string }): MaybePromise<void>;
 }
 
 // Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts


Test patch:
diff --git a/packages/create-svelte/shared/+default+vitest/src/routes/sverdle/game.test.ts b/packages/create-svelte/shared/+default+vitest/src/routes/sverdle/game.test.ts
new file mode 100644
index 000000000..99028b6f5
--- /dev/null
+++ b/packages/create-svelte/shared/+default+vitest/src/routes/sverdle/game.test.ts
@@ -0,0 +1,9 @@
+import { describe, it, expect } from 'vitest';
+import { Game } from './game';
+
+describe('game test', () => {
+	it('returns true when a valid word is entered', () => {
+		const game = new Game();
+		expect(game.enter('zorro'.split(''))).toBe(true);
+	});
+});
diff --git a/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts b/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts
new file mode 100644
index 000000000..4e579377e
--- /dev/null
+++ b/packages/create-svelte/shared/+playwright+skeletonlib/tests/test.ts
@@ -0,0 +1,6 @@
+import { expect, test } from '@playwright/test';
+
+test('index page has expected h1', async ({ page }) => {
+	await page.goto('/');
+	expect(await page.textContent('h1')).toBe('Welcome to SvelteKit');
+});
diff --git a/packages/create-svelte/shared/+vitest+skeleton/src/index.test.ts b/packages/create-svelte/shared/+vitest+skeleton/src/index.test.ts
new file mode 100644
index 000000000..e07cbbd72
--- /dev/null
+++ b/packages/create-svelte/shared/+vitest+skeleton/src/index.test.ts
@@ -0,0 +1,7 @@
+import { describe, it, expect } from 'vitest';
+
+describe('sum test', () => {
+	it('adds 1 + 2 to equal 3', () => {
+		expect(1 + 2).toBe(3);
+	});
+});
diff --git a/packages/create-svelte/shared/+vitest+skeletonlib/src/index.test.ts b/packages/create-svelte/shared/+vitest+skeletonlib/src/index.test.ts
new file mode 100644
index 000000000..e07cbbd72
--- /dev/null
+++ b/packages/create-svelte/shared/+vitest+skeletonlib/src/index.test.ts
@@ -0,0 +1,7 @@
+import { describe, it, expect } from 'vitest';
+
+describe('sum test', () => {
+	it('adds 1 + 2 to equal 3', () => {
+		expect(1 + 2).toBe(3);
+	});
+});
diff --git a/packages/create-svelte/shared/+vitest/package.json b/packages/create-svelte/shared/+vitest/package.json
new file mode 100644
index 000000000..fea2892af
--- /dev/null
+++ b/packages/create-svelte/shared/+vitest/package.json
@@ -0,0 +1,8 @@
+{
+	"devDependencies": {
+		"vitest": "^0.23.4"
+	},
+	"scripts": {
+		"test:unit": "vitest"
+	}
+}
diff --git a/packages/create-svelte/shared/+vitest/vite.config.js b/packages/create-svelte/shared/+vitest/vite.config.js
new file mode 100644
index 000000000..652979fb4
--- /dev/null
+++ b/packages/create-svelte/shared/+vitest/vite.config.js
@@ -0,0 +1,11 @@
+import { sveltekit } from '@sveltejs/kit/vite';
+
+/** @type {import('vite').UserConfig} */
+const config = {
+	plugins: [sveltekit()],
+	test: {
+		include: ['src/**/*.{test,spec}.{js,ts}']
+	}
+};
+
+export default config;
diff --git a/packages/kit/test/apps/basics/test/client.test.js b/packages/kit/test/apps/basics/test/client.test.js
index 65aa6cdc7..103855f34 100644
--- a/packages/kit/test/apps/basics/test/client.test.js
+++ b/packages/kit/test/apps/basics/test/client.test.js
@@ -607,9 +607,7 @@ test.describe('Load', () => {
 	});
 
 	if (process.env.DEV) {
-		test('using window.fetch causes a warning', async ({ page }) => {
-			const port = 5173;
-
+		test('using window.fetch causes a warning', async ({ page, baseURL }) => {
 			/** @type {string[]} */
 			const warnings = [];
 
@@ -623,7 +621,7 @@ test.describe('Load', () => {
 			expect(await page.textContent('h1')).toBe('42');
 
 			expect(warnings).toContain(
-				`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/load#making-fetch-requests`
+				`Loading ${baseURL}/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/load#making-fetch-requests`
 			);
 
 			warnings.length = 0;
@@ -632,7 +630,7 @@ test.describe('Load', () => {
 			expect(await page.textContent('h1')).toBe('42');
 
 			expect(warnings).not.toContain(
-				`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/load#making-fetch-requests`
+				`Loading ${baseURL}/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/load#making-fetch-requests`
 			);
 		});
 	}