test: run supabase locally during test (#35947)

Alter the docs test script so it spins up Supabase locally. Will allow
for end-to-end tests against the local DB.

Also small alteration to one of the test files to silence an annoying
(but intended) error.
This commit is contained in:
Charis authored and GitHub committed 2025-05-27 10:00:21 -04:00
1 parent 9318404e61
commit bf3bada7fd
3 files changed
+9 -2

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ jobs:
apps/docs
examples
packages
supabase
- uses: pnpm/action-setup@v4
name: Install pnpm
@@ -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')
})
+2 -1
View File
@@ -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",