const path = require('path') const rootDir = path.resolve(__dirname, '..') /** * Jest project for the backend live HTTP/tRPC API tests. * * The tests talk to a RUNNING backend over HTTP. They never import server * runtime code beyond the AppRouter type. * * cd apps/backend && bun run dev # wrangler dev on :8787 * bun run test:api # this project */ module.exports = { rootDir, roots: ['/tests'], testEnvironment: 'node', testMatch: ['/tests/**/*.test.ts'], setupFiles: ['/tests/setup.ts'], globalSetup: '/tests/global-setup.ts', clearMocks: true, // The suites share one local backend/D1 and mutate data — run serially. maxWorkers: 1, testTimeout: 180_000, 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', }, }