module.exports = { preset: 'ts-jest', testEnvironment: 'node', roots: ['/src', '/tests'], testMatch: ['**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts'], // The end-to-end suite (tests/e2e/*.e2e.test.ts) runs the REAL Express app // against a REAL Postgres + Redis and has its own config (jest.e2e.config.js, // run via `npm run test:e2e`). Excluding it here keeps the default unit / // integration run deterministic — it must not require Docker datastores and // must not collide on ports when run in parallel. testPathIgnorePatterns: ['/node_modules/', '/tests/e2e/'], transform: { '^.+\\.ts$': ['ts-jest', { diagnostics: false }], }, collectCoverageFrom: [ 'src/**/*.ts', '!src/**/*.d.ts', '!src/index.ts', ], coverageDirectory: 'coverage', coverageReporters: ['text', 'lcov', 'html'], moduleNameMapper: { '^@/(.*)$': '/src/$1', '^@trpc/server(.*)$': '/tests/__mocks__/@trpc/server$1', '^../trpc/adapter$': '/tests/__mocks__/trpcAdapter', '^../../trpc/adapter$': '/tests/__mocks__/trpcAdapter', '^./trpc/adapter$': '/tests/__mocks__/trpcAdapter', }, setupFilesAfterEnv: ['/tests/setup.ts'], };