/** @type {import('jest').Config} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/src', '<rootDir>/tests'],
testMatch: [
'**/__tests__/**/*.+(ts|tsx|js)',
'**/?(*.)+(spec|test).+(ts|tsx|js)'
],
// Exclude MCP tests from regular test runs by default (they spawn processes)
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/tests/mcp/' // MCP tests should be run separately due to process spawning
],
transform: {
'^.+\\.(ts|tsx)$': ['ts-jest', {
useESM: true
}],
},
collectCoverageFrom: [
'src/**/*.{js,ts}',
'!src/**/*.d.ts',
'!src/index.ts',
],
coverageThreshold: {
global: {
branches: 95,
functions: 95,
lines: 95,
statements: 95,
},
},
coverageReporters: [
'text',
'lcov',
'html',
'json-summary',
'clover'
],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
'^(\\.{1,2}/.*)\\.js$': '$1',
},
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testTimeout: 30000,
verbose: true,
extensionsToTreatAsEsm: ['.ts']
};