feat: migrate test runner from Bun to Vitest

- Replace bun:test with Vitest across all 22 test files
- Create @sofa/test package with shared setup and DB test helpers
  - setup.ts: vi.mock for @sofa/db/client, Bun.randomUUIDv7 polyfill
  - db.ts: in-memory SQLite via better-sqlite3, seed helpers
- Add per-project vitest configs (packages/core, apps/web)
- Add root vitest.config.ts with projects and v8 coverage
- Set up @vitest/browser + Playwright for web component tests
- Move validateBackupDatabase from core/backup.ts to @sofa/db/client
- Derive required backup tables from schema instead of hard-coded list
- Update CI workflow with Playwright install and Codecov upload
- Update CLAUDE.md documentation for Vitest

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-22 12:03:06 -04:00
co-authored by Claude Opus 4.6
parent 3f05e08fea
commit 5f3e14b415
45 changed files with 589 additions and 364 deletions
+21 -10
View File
@@ -7,15 +7,7 @@
"packages/*"
],
"catalog": {
"@better-auth/expo": "1.5.5",
"@orpc/client": "1.13.9",
"@orpc/contract": "1.13.9",
"@orpc/tanstack-query": "1.13.9",
"@tanstack/react-query": "5.94.5",
"@types/bun": "1.3.11",
"@types/node": "25.5.0",
"@types/react": "19.2.14",
"better-auth": "1.5.5",
"@better-auth/expo": "1.5.6",
"@lingui/babel-plugin-lingui-macro": "5.9.3",
"@lingui/cli": "5.9.3",
"@lingui/conf": "5.9.3",
@@ -24,12 +16,26 @@
"@lingui/metro-transformer": "5.9.3",
"@lingui/react": "5.9.3",
"@lingui/vite-plugin": "5.9.3",
"@orpc/client": "1.13.9",
"@orpc/contract": "1.13.9",
"@orpc/tanstack-query": "1.13.9",
"@tanstack/react-query": "5.94.5",
"@types/bun": "1.3.11",
"@types/node": "25.5.0",
"@types/react": "19.2.14",
"@vitest/browser": "4.1.0",
"@vitest/browser-playwright": "4.1.0",
"@vitest/coverage-v8": "4.1.0",
"better-auth": "1.5.6",
"drizzle-kit": "1.0.0-beta.18-7eb39f0",
"drizzle-orm": "1.0.0-beta.18-7eb39f0",
"react": "19.2.0",
"react-dom": "19.2.0",
"tailwind-merge": "3.5.0",
"tailwindcss": "4.2.2",
"thumbhash": "0.1.1",
"typescript": "5.9.3",
"vitest": "4.1.0",
"zod": "4.3.6"
}
},
@@ -53,11 +59,16 @@
"@lingui/cli": "catalog:",
"@lingui/conf": "catalog:",
"@lingui/format-po": "catalog:",
"@vitest/browser": "catalog:",
"@vitest/browser-playwright": "catalog:",
"@vitest/coverage-v8": "catalog:",
"eslint-plugin-lingui": "0.11.0",
"oxfmt": "0.41.0",
"oxlint": "1.56.0",
"playwright": "1.58.2",
"turbo": "2.8.20",
"typescript": "catalog:"
"typescript": "catalog:",
"vitest": "catalog:"
},
"packageManager": "bun@1.3.11"
}