Repository: sveltejs/kit
Pull request #9052 (2023-02-14 22:28:17)

fix(test): use file: protocol for overrides in create-svelte tests for stricter resolve
see #9047  which was not caught even though  create-svelte tests do run `build` in a project created with local `create-svelte`.

for some reason absolute path overrides without `file:` protocol are treated differently, adding it made the test fail with when using `@sveltejs/kit/paths` instead of `__sveltekit_paths` as internal virtual module.


### 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
- [ ] 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. Changesets that add features should be `minor` and those that fix bugs should be `patch`. Please prefix changeset messages with `feat:`, `fix:`, or `chore:`.



Patch:
diff --git a/packages/create-svelte/templates/skeleton/package.json b/packages/create-svelte/templates/skeleton/package.json
index 587569066..1706b9d75 100644
--- a/packages/create-svelte/templates/skeleton/package.json
+++ b/packages/create-svelte/templates/skeleton/package.json
@@ -1,5 +1,6 @@
 {
 	"name": "skeleton-template",
+	"private": true,
 	"version": "0.0.1-next.0",
 	"devDependencies": {
 		"@sveltejs/adapter-auto": "workspace:*"
diff --git a/sites/kit.svelte.dev/package.json b/sites/kit.svelte.dev/package.json
index 488e8d6d2..fa519838b 100644
--- a/sites/kit.svelte.dev/package.json
+++ b/sites/kit.svelte.dev/package.json
@@ -1,5 +1,6 @@
 {
 	"name": "kit.svelte.dev",
+	"private": true,
 	"version": "0.0.1",
 	"scripts": {
 		"update": "node scripts/check-doc-links.js && node scripts/types",


Test patch:
diff --git a/packages/create-svelte/test/check.js b/packages/create-svelte/test/check.js
index d0ca7b402..a1ee4bb53 100644
--- a/packages/create-svelte/test/check.js
+++ b/packages/create-svelte/test/check.js
@@ -21,7 +21,8 @@ const overrides = { ...existing_workspace_overrides };
 	await glob(fileURLToPath(new URL('../../../packages', import.meta.url)) + '/*/package.json')
 ).forEach((pkgPath) => {
 	const name = JSON.parse(fs.readFileSync(pkgPath, 'utf-8')).name;
-	overrides[name] = path.dirname(path.resolve(pkgPath));
+	// use `file:` protocol for opting into stricter resolve logic which catches more bugs
+	overrides[name] = `file:${path.dirname(path.resolve(pkgPath))}`;
 });
 
 try {
diff --git a/packages/kit/test/github-flaky-warning-reporter.js b/packages/kit/test/github-flaky-warning-reporter.js
new file mode 100644
index 000000000..59eb5e5a4
--- /dev/null
+++ b/packages/kit/test/github-flaky-warning-reporter.js
@@ -0,0 +1,35 @@
+/**
+ * @class
+ * @implements {import('@playwright/test/reporter').Reporter}
+ */
+export default class GithubFlakyWarningReporter {
+	/**
+	 * @type {{ file: string; line: number; title: string; message: string; }[]}
+	 */
+	_flaky = [];
+
+	onBegin() {
+		this._flaky = [];
+	}
+	/**
+	 * @param test {import('@playwright/test/reporter').TestCase}
+	 */
+	onTestEnd(test) {
+		if (test.outcome() === 'flaky') {
+			const { file, line } = test.location;
+			const title = `flaky test: ${test.title}`;
+			const message = `retries: ${test.retries}`;
+			this._flaky.push({ file, line, title, message });
+		}
+	}
+
+	onEnd() {
+		this._flaky.forEach(({ file, line, title, message }) => {
+			console.log(`::warning file=${file},line=${line},title=${title}::${message}`);
+		});
+	}
+
+	printsToStdio() {
+		return true;
+	}
+}
diff --git a/packages/kit/test/utils.js b/packages/kit/test/utils.js
index 449251bc1..e3e517a34 100644
--- a/packages/kit/test/utils.js
+++ b/packages/kit/test/utils.js
@@ -1,6 +1,8 @@
 import fs from 'fs';
+import path from 'path';
 import http from 'http';
 import { test as base, devices } from '@playwright/test';
+import { fileURLToPath } from 'url';
 
 export const test = base.extend({
 	app: async ({ page }, use) => {
@@ -245,5 +247,11 @@ export const config = {
 		screenshot: 'only-on-failure',
 		trace: 'retain-on-failure'
 	},
-	workers: process.env.CI ? 2 : undefined
+	workers: process.env.CI ? 2 : undefined,
+	reporter: process.env.CI
+		? [
+				['dot'],
+				[path.resolve(fileURLToPath(import.meta.url), '../github-flaky-warning-reporter.js')]
+		  ]
+		: 'list'
 };