module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  roots: ['<rootDir>/src'],
  testMatch: ['**/__tests__/**/*.test.ts'],
  transform: {
    '^.+\\.ts$': 'ts-jest',
  },
  collectCoverageFrom: [
    'src/**/*.ts',
    '!src/**/*.d.ts',
    '!src/**/__tests__/**',
  ],
  coverageDirectory: 'coverage',
  coverageReporters: ['text', 'lcov', 'html'],
  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
  testTimeout: 60000, // Increase timeout for property-based tests
  maxWorkers: 1, // Run tests sequentially to avoid resource conflicts
  moduleNameMapper: {
    '^@cloneweb/shared$': '<rootDir>/../../packages/shared/dist/index.js',
    '^@cloneweb/types$': '<rootDir>/../../packages/types/dist/index.js',
    '^@cloneweb/database$': '<rootDir>/../../packages/database/dist/index.js'
  }
};