jest.config.jsā¢2.18 kB
/**
* Jest Configuration for HubSpot MCP Server
*
* Comprehensive testing configuration with coverage reporting
* and performance monitoring for the MCP protocol implementation.
*/
module.exports = {
// Test environment
testEnvironment: 'node',
// Root directory for tests
rootDir: '.',
// Test file patterns
testMatch: [
'<rootDir>/tests/**/*.test.js',
'<rootDir>/tests/**/*.spec.js'
],
// Files to ignore
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/build/',
'/coverage/',
'/.docker/',
'/.git/'
],
// Coverage configuration
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: [
'text',
'text-summary',
'html',
'lcov'
],
// Coverage thresholds for quality gates
coverageThreshold: {
global: {
branches: 75,
functions: 80,
lines: 80,
statements: 80
},
'./src/server.js': {
branches: 70,
functions: 75,
lines: 75,
statements: 75
}
},
// Files to collect coverage from
collectCoverageFrom: [
'src/**/*.js',
'!src/**/*.test.js',
'!src/**/__tests__/**',
'!**/node_modules/**'
],
// Setup files
setupFilesAfterEnv: [
'<rootDir>/tests/setup.js'
],
// Test timeout for async operations
testTimeout: 30000,
// Verbose output for detailed test results
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Restore mocks after each test
restoreMocks: true,
// Reset modules between tests
resetModules: true,
// Module directories
moduleDirectories: [
'node_modules',
'src'
],
// Module file extensions
moduleFileExtensions: [
'js',
'json',
'node'
],
// Global test environment variables
globals: {
NODE_ENV: 'test'
},
// Error handling configuration
errorOnDeprecated: true,
// Performance monitoring
detectOpenHandles: true,
detectLeaks: true,
// Force exit after tests complete
forceExit: true,
// Worker configuration
maxWorkers: '50%',
// Cache configuration
cache: true,
cacheDirectory: '<rootDir>/.jest-cache'
};