Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

test: Simplify setup (#48036)

Jeremias Menichelli06c2039d0bbf
diff --git a/apps/docs/middleware.test.ts b/apps/docs/middleware.test.ts
index 2c0c111e939..87d171621d9 100644
--- a/apps/docs/middleware.test.ts
+++ b/apps/docs/middleware.test.ts
@@ -1,8 +1,14 @@
import { NextRequest } from 'next/server'
-import { describe, expect, it } from 'vitest'
+import { describe, expect, it, vi } from 'vitest'
import { middleware } from './middleware'
+// The real manifest is generated at build time by a content script; mocking
+// it here decouples this test from that build step.
+vi.mock('~/public/markdown/manifest.json', () => ({
+ default: ['auth'],
+}))
+
// BASE_PATH defaults to '/docs' when NEXT_PUBLIC_BASE_PATH is unset, so test
// paths include the /docs prefix to match the middleware's GUIDES_PATH check.
function makeRequest(
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 737d46427f8..704b3a23ccc 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -42,10 +42,7 @@
"preinstall": "npx only-allow pnpm",
"presync": "pnpm run codegen:graphql",
"pretest": "pnpm run codegen:examples",
- "pretest:local": "pnpm run build:guides-markdown",
- "pretest:local:unwatch": "pnpm run build:guides-markdown",
- "pretest:smoke": "pnpm run build:guides-markdown",
- "pretypecheck": "pnpm run codegen:graphql && pnpm run build:markdown && next typegen",
+ "pretypecheck": "pnpm run codegen:graphql && next typegen",
"start": "next start",
"sync": "tsx --conditions=react-server ./resources/rootSync.ts",
"test": "pnpm supabase start && pnpm run test:local && pnpm supabase stop",
diff --git a/apps/docs/types/manifest.d.ts b/apps/docs/types/manifest.d.ts
new file mode 100644
index 00000000000..191ccfe5436
--- /dev/null
+++ b/apps/docs/types/manifest.d.ts
@@ -0,0 +1,6 @@
+// public/markdown/manifest.json is generated by internals/generate-guides-markdown.ts
+// and gitignored, so it may not exist on disk when tsc runs.
+declare module '~/public/markdown/manifest.json' {
+ const slugs: string[]
+ export default slugs
+}