Skip to content

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

test: run supabase locally during test (#35947)

Charisbf3bada7fd74
diff --git a/.github/workflows/docs-tests.yml b/.github/workflows/docs-tests.yml
index 714df8489ec..dc029e56c5b 100644
--- a/.github/workflows/docs-tests.yml
+++ b/.github/workflows/docs-tests.yml
@@ -25,6 +25,7 @@ jobs:
apps/docs
examples
packages
+ supabase
- uses: pnpm/action-setup@v4
name: Install pnpm
diff --git a/apps/docs/app/api/graphql/tests/searchDocs.test.ts b/apps/docs/app/api/graphql/tests/searchDocs.test.ts
index 1d9d3c3d03c..3788f58697d 100644
--- a/apps/docs/app/api/graphql/tests/searchDocs.test.ts
+++ b/apps/docs/app/api/graphql/tests/searchDocs.test.ts
@@ -1,4 +1,4 @@
-import { afterAll, describe, expect, it, vi } from 'vitest'
+import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest'
import { Result } from '~/features/helpers.fn'
import { type OpenAIClientInterface } from '~/lib/openAi'
import { ApiError } from '../../utils'
@@ -45,7 +45,12 @@ vi.mock('~/lib/supabase', () => ({
}))
describe('/api/graphql searchDocs', () => {
+ beforeAll(() => {
+ vi.spyOn(console, 'error').mockImplementation(() => {})
+ })
+
afterAll(() => {
+ vi.restoreAllMocks()
vi.doUnmock('~/lib/openAi')
vi.doUnmock('~/lib/supabase')
})
diff --git a/apps/docs/package.json b/apps/docs/package.json
index 36753e57541..4215dcb5c99 100644
--- a/apps/docs/package.json
+++ b/apps/docs/package.json
@@ -20,7 +20,8 @@
"pretypecheck": "pnpm run codegen:graphql",
"typecheck": "tsc --noEmit",
"pretest": "pnpm run codegen:examples",
- "test": "vitest --exclude \"**/*.smoke.test.ts\"",
+ "test": "pnpm supabase start && pnpm run test:local && pnpm supabase stop",
+ "test:local": "vitest --exclude \"**/*.smoke.test.ts\"",
"test:smoke": "pnpm run codegen:references && vitest -t \"prod smoke test\"",
"embeddings": "tsx scripts/search/generate-embeddings.ts",
"embeddings:refresh": "pnpm run embeddings --refresh",