refactor: migrate monorepo from pnpm to Bun runtime and workspaces
- root: bun workspaces via package.json, packageManager bun@1.4.0, scripts use bun --filter - backend: Bun.serve, bun test (vitest removed), bun --watch dev script, tsconfig types bun - tests: migrate 6 test files from vitest to bun:test (mock.module) - validate: replace @hono/zod-validator with hono validator + zod safeParse (fixes TS2589) - lockfile: bunfig.toml saveTextLockfile, regenerated bun.lock (text) for turbo - docs: AGENTS.md, README.md, stack.md updated to Bun stack
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { beforeEach, describe, expect, it, mock, vi } from 'bun:test';
|
||||
import { Hono } from 'hono';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
vi.mock('@/lib/prisma', () => ({
|
||||
mock.module('@/lib/prisma', () => ({
|
||||
default: {
|
||||
$queryRaw: vi.fn(),
|
||||
$queryRaw: mock(),
|
||||
},
|
||||
getPrismaClient: vi.fn(),
|
||||
getPrismaClient: mock(),
|
||||
UnitOfWork: class {},
|
||||
}));
|
||||
|
||||
@@ -21,7 +21,7 @@ describe('health check routes', () => {
|
||||
});
|
||||
|
||||
it('reports ok when the database answers', async () => {
|
||||
vi.mocked(prisma.$queryRaw).mockResolvedValue([{ '?column?': 1 }]);
|
||||
prisma.$queryRaw.mockResolvedValue([{ '?column?': 1 }]);
|
||||
|
||||
const res = await app.request('/health');
|
||||
|
||||
@@ -32,7 +32,7 @@ describe('health check routes', () => {
|
||||
});
|
||||
|
||||
it('reports degraded when the database is unreachable', async () => {
|
||||
vi.mocked(prisma.$queryRaw).mockRejectedValue(new Error('connection refused'));
|
||||
prisma.$queryRaw.mockRejectedValue(new Error('connection refused'));
|
||||
|
||||
const res = await app.request('/health');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user