- Integrated all production features into main application flow - Added metrics, tracing, caching, and health checks to API server - Enhanced trade execution with circuit breakers and retry policies - Integrated database persistence for trades and metrics - Added structured logging and observability - Enhanced middleware with missing validators and rate limiters - Added comprehensive error handling and resilience patterns
62 lines
1.5 KiB
JavaScript
62 lines
1.5 KiB
JavaScript
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
module.exports = {
|
|
preset: 'ts-jest',
|
|
testEnvironment: 'node',
|
|
roots: ['<rootDir>/src', '<rootDir>/tests'],
|
|
testMatch: ['**/__tests__/**/*.ts', '**/*.test.ts', '**/*.spec.ts'],
|
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
collectCoverageFrom: [
|
|
'src/**/*.ts',
|
|
'!src/**/*.d.ts',
|
|
'!src/**/*.test.ts',
|
|
'!src/**/*.spec.ts',
|
|
'!src/index.ts', // Main entry point
|
|
'!src/api-server.ts', // API server (tested via integration tests)
|
|
],
|
|
coverageDirectory: 'coverage',
|
|
coverageReporters: ['text', 'lcov', 'html', 'json'],
|
|
coverageThreshold: {
|
|
global: {
|
|
branches: 80,
|
|
functions: 85,
|
|
lines: 85,
|
|
statements: 85,
|
|
},
|
|
// Critical paths require 90% coverage
|
|
'src/blockchain/tradeExecutor.ts': {
|
|
branches: 90,
|
|
functions: 90,
|
|
lines: 90,
|
|
statements: 90,
|
|
},
|
|
'src/agent/aiDecision.ts': {
|
|
branches: 90,
|
|
functions: 90,
|
|
lines: 90,
|
|
statements: 90,
|
|
},
|
|
'src/utils/safeguards.ts': {
|
|
branches: 90,
|
|
functions: 90,
|
|
lines: 90,
|
|
statements: 90,
|
|
},
|
|
},
|
|
moduleNameMapper: {
|
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
},
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
globals: {
|
|
'ts-jest': {
|
|
useESM: true,
|
|
tsconfig: {
|
|
esModuleInterop: true,
|
|
allowSyntheticDefaultImports: true,
|
|
},
|
|
},
|
|
},
|
|
testTimeout: 10000,
|
|
maxWorkers: '50%', // Run tests in parallel with 50% of available CPUs
|
|
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
|
|
};
|