const path = require('path') const rootDir = path.resolve(__dirname, '..') /** * Jest project for the backend HTTP/API tests. * * These tests talk to a RUNNING backend over HTTP — they do not import server * runtime code beyond the AppRouter type. Start the server first: * * cd apps/backend && bun run dev # wrangler dev on :8787 * bun run test:api # from apps/backend * * Credentials come from tests/.env (see tests/.env.example). */ module.exports = { rootDir, roots: ['/tests'], testEnvironment: 'node', testMatch: ['/tests/**/*.test.ts'], setupFiles: ['/tests/setup.ts'], clearMocks: true, // The suites share one user/session and mutate shared data — run serially. maxWorkers: 1, testTimeout: 180000, transform: { '^.+\\.tsx?$': ['ts-jest', { tsconfig: '/tests/tsconfig.json' }], }, moduleNameMapper: { '^@/(.*)$': '/$1', '^@packages/shared$': '/../../packages/shared', '^@packages/shared/(.*)$': '/../../packages/shared/$1', '^global-shared$': '/../../packages/shared', '^global-shared/(.*)$': '/../../packages/shared/$1', '^shared-types$': '/../shared-types', '^sqliteService$': '/../../packages/db_helper_sqlite', '^sqliteService/(.*)$': '/../../packages/db_helper_sqlite/$1', '^common-ui$': '/../../packages/ui', '^common-ui/(.*)$': '/../../packages/ui/$1', }, }