/** @type {import('jest').Config} */
module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  rootDir: '.',
  testMatch: [
    '<rootDir>/tests/**/*.test.ts',
    '<rootDir>/tests/**/*.spec.ts'
  ],
  collectCoverageFrom: [
    'src/**/*.ts',
    '!src/**/*.d.ts',
    '!src/index.ts'
  ],
  coverageDirectory: 'coverage',
  coverageReporters: [
    'text',
    'lcov',
    'html'
  ],
  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 80,
      statements: 80
    }
  },
  moduleNameMapper: {
    '^@/(.*)$': '<rootDir>/src/$1',
    '^@/core/(.*)$': '<rootDir>/src/core/$1',
    '^@/platforms/(.*)$': '<rootDir>/src/platforms/$1',
    '^@/loaders/(.*)$': '<rootDir>/src/loaders/$1'
  },
  transformIgnorePatterns: [
    'node_modules/(?!(@noble/.*|@noble/ed25519|@noble/hashes)/)'
  ],
  setupFilesAfterEnv: [
    '<rootDir>/tests/setup.ts'
  ],
  testTimeout: 30000,
  verbose: true,
  collectCoverage: false, // Only when explicitly requested
  maxWorkers: '50%',
  cacheDirectory: '.jest-cache'
};