module.exports = { testEnvironment: 'node', coverageDirectory: 'coverage', setupFiles: ['/tests/env.js'], collectCoverageFrom: [ 'src/**/*.js', '!src/index.js', // Server startup '!src/generate-openapi.js', // Build tool '!src/scripts/**', // Utility scripts ], testMatch: [ '**/tests/**/*.test.js', '**/tests/**/*.spec.js' ], coverageThreshold: { global: { branches: 20, functions: 20, lines: 20, statements: 20 } }, // Setup for each test file - initializes server once setupFilesAfterEnv: ['/tests/setup.js'], testTimeout: 10000, // Run tests serially to avoid DB conflicts maxWorkers: 1, // Force exit after tests complete forceExit: true, // Transform ESM modules in node_modules transformIgnorePatterns: [ 'node_modules/(?!(uuid)/)' ] };