Skip to content

An AI-powered search engine with a generative UI

fix: restore v0.5 test setup and update CI for conditional test runs

Yoshiki Miura9b69e646ee9e
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0c35c4cb..c24434fd 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -36,7 +36,11 @@ jobs:
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/db
+ # Run tests only if test script exists (for v0.5 branch)
- name: Run tests
- run: bun test
+ run: |
+ if [ -f "vitest.config.ts" ]; then
+ bun run test
+ fi
env:
DATABASE_URL: postgresql://user:pass@localhost:5432/db
diff --git a/vitest.setup.ts b/vitest.setup.ts
index d4d06fee..2e597295 100644
--- a/vitest.setup.ts
+++ b/vitest.setup.ts
@@ -1,5 +1,13 @@
import '@testing-library/jest-dom'
+import { vi } from 'vitest'
// Provide dummy values for environment variables required during tests
process.env.DATABASE_URL =
process.env.DATABASE_URL ?? 'postgres://user:pass@localhost:5432/testdb'
+
+// Mock Next.js functions
+vi.mock('next/cache', () => ({
+ revalidateTag: vi.fn(),
+ revalidatePath: vi.fn(),
+ unstable_cache: vi.fn((fn) => fn)
+}))