/** @type {import('jest').Config} */ export default { preset: 'ts-jest/presets/default-esm', extensionsToTreatAsEsm: ['.ts'], globals: { 'ts-jest': { useESM: true, }, }, testEnvironment: 'node', roots: ['/src'], testMatch: [ '**/__tests__/**/*.ts', '**/?(*.)+(spec|test).ts' ], transform: { '^.+\\.ts$': ['ts-jest', { useESM: true, }], }, collectCoverageFrom: [ 'src/**/*.ts', '!src/**/*.d.ts', '!src/**/index.ts', '!src/test-utils/**', '!src/setup/**' ], coverageDirectory: 'coverage', coverageReporters: [ 'text', 'lcov', 'html', 'json-summary' ], coverageThreshold: { global: { branches: 90, functions: 90, lines: 90, statements: 90 } }, setupFilesAfterEnv: [ '/src/setup/jest.setup.ts' ], moduleNameMapping: { '^@/(.*)$': '/src/$1', '^@test/(.*)$': '/src/test-utils/$1' }, testTimeout: 30000, maxWorkers: '50%', // Enable memory leak detection detectOpenHandles: true, detectLeaks: true, // WASM configuration moduleFileExtensions: ['ts', 'js', 'json', 'wasm'], projects: [ { displayName: 'unit', testMatch: ['/src/unit/**/*.test.ts'] }, { displayName: 'integration', testMatch: ['/src/integration/**/*.test.ts'] }, { displayName: 'e2e', testMatch: ['/src/e2e/**/*.test.ts'], testEnvironment: 'node' }, { displayName: 'performance', testMatch: ['/src/performance/**/*.test.ts'], testTimeout: 60000 }, { displayName: 'memory', testMatch: ['/src/memory/**/*.test.ts'], testTimeout: 120000 }, { displayName: 'cli', testMatch: ['/src/cli/**/*.test.ts'] }, { displayName: 'mcp', testMatch: ['/src/mcp/**/*.test.ts'] }, { displayName: 'regression', testMatch: ['/src/regression/**/*.test.ts'] } ] };