fix(tests): add @prisma/client mock for test isolation
Pull Request / unit-tests (pull_request) Successful in 1m3s
Pull Request / acceptance-tests (pull_request) Failing after 3s
Pull Request / analyze-bump-type (pull_request) Has been skipped

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:
2026-04-01 14:06:57 -07:00
parent e921f17d2c
commit d8a8931bc3
+13
View File
@@ -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,