fix(tests): add @prisma/client mock for test isolation
Mock @prisma/client globally in bun-setup.ts to allow unit tests to run without requiring the generated Prisma client. This improves test isolation and allows tests to pass even when prisma generate hasn't been run.
This commit is contained in:
@@ -1,8 +1,21 @@
|
||||
// Setup file for Bun test runner to provide DOM environment
|
||||
import { JSDOM } from 'jsdom';
|
||||
import { mock } from 'bun:test';
|
||||
|
||||
console.log('Loading bun-setup.ts...');
|
||||
|
||||
// Mock @prisma/client to avoid dependency on generated Prisma client
|
||||
// This allows unit tests to run without requiring `prisma generate`
|
||||
mock.module('@prisma/client', () => {
|
||||
return {
|
||||
PrismaClient: class MockPrismaClient {
|
||||
$connect() {}
|
||||
$disconnect() {}
|
||||
$transaction() {}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>', {
|
||||
url: 'http://localhost',
|
||||
pretendToBeVisual: true,
|
||||
|
||||
Reference in New Issue
Block a user