Files
ruflo/tests/test.config.ts
T
rUvandClaude dba545f012 feat: Complete Claude-Flow Advanced AI Agent Orchestration System
- Implemented comprehensive multi-agent orchestration system
- Added sophisticated task scheduling with priority management
- Built persistent memory management with hybrid SQLite/Markdown backends
- Created terminal session management with pooling capabilities
- Implemented resource coordination with deadlock detection
- Added MCP integration for tool management
- Built interactive CLI with REPL mode
- Created comprehensive test suite with 100% coverage goal
- Added CI/CD pipeline with GitHub Actions
- Implemented comprehensive documentation and guides
- Updated package.json for npm deployment
- Created claude.md comprehensive system guide

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-10 03:48:41 +00:00

168 lines
3.7 KiB
TypeScript

/**
* Test configuration for Claude-Flow
*/
export const TEST_CONFIG = {
// Test timeouts
timeout: {
unit: 15000,
integration: 45000,
e2e: 90000,
performance: 120000,
},
// Test directories
directories: {
unit: './tests/unit',
integration: './tests/integration',
e2e: './tests/e2e',
performance: './tests/performance',
fixtures: './tests/fixtures',
mocks: './tests/mocks',
coverage: './test-results/coverage',
reports: './test-results',
},
// Coverage thresholds - targeting >90% coverage
coverage: {
branches: 90,
functions: 95,
lines: 90,
statements: 90,
},
// Test environment
env: {
CLAUDE_FLOW_ENV: 'test',
CLAUDE_FLOW_LOG_LEVEL: 'silent',
CLAUDE_FLOW_DATA_DIR: './tests/data',
CLAUDE_FLOW_CONFIG_FILE: './tests/fixtures/test-config.json',
CLAUDE_FLOW_DISABLE_METRICS: 'true',
CLAUDE_FLOW_DISABLE_TELEMETRY: 'true',
},
// Performance test settings
performance: {
concurrent_tasks: [1, 5, 10, 20, 50],
memory_limits: [100, 500, 1000], // MB
timeout_stress_duration: 30000, // 30 seconds
load_test_requests: 1000,
},
// Mock configurations
mocks: {
mcp_server_port: 8899,
terminal_delay: 100, // ms
memory_flush_delay: 50, // ms
},
// Test data configurations
fixtures: {
small_memory_entries: 100,
large_memory_entries: 10000,
test_files_count: 50,
large_file_size: 1024 * 1024, // 1MB
},
};
/**
* Setup test environment
*/
export function setupTestEnv(): void {
// Set environment variables
Object.entries(TEST_CONFIG.env).forEach(([key, value]) => {
Deno.env.set(key, value);
});
// Ensure test directories exist
ensureTestDirectories();
}
/**
* Cleanup test environment
*/
export async function cleanupTestEnv(): Promise<void> {
// Remove test data directory
const cleanupPaths = [
TEST_CONFIG.env.CLAUDE_FLOW_DATA_DIR,
'./tests/temp',
'./tests/fixtures/temp',
'./test-results/temp',
];
for (const path of cleanupPaths) {
try {
await Deno.remove(path, { recursive: true });
} catch {
// Ignore if doesn't exist
}
}
}
/**
* Ensure test directories exist
*/
function ensureTestDirectories(): void {
const directories = Object.values(TEST_CONFIG.directories);
directories.forEach(dir => {
try {
Deno.mkdirSync(dir, { recursive: true });
} catch {
// Directory already exists
}
});
// Create additional test directories
const additionalDirs = [
'./tests/temp',
'./tests/data',
'./tests/fixtures/temp',
'./test-results/temp',
];
additionalDirs.forEach(dir => {
try {
Deno.mkdirSync(dir, { recursive: true });
} catch {
// Directory already exists
}
});
}
/**
* Get test timeout for suite type
*/
export function getTestTimeout(suiteType: keyof typeof TEST_CONFIG.timeout): number {
return TEST_CONFIG.timeout[suiteType];
}
/**
* Check if test environment is properly configured
*/
export function validateTestEnvironment(): boolean {
// Check required environment variables
const requiredEnvVars = Object.keys(TEST_CONFIG.env);
const missingVars = requiredEnvVars.filter(varName => !Deno.env.get(varName));
if (missingVars.length > 0) {
console.error(`Missing test environment variables: ${missingVars.join(', ')}`);
return false;
}
// Check test directories
const directories = Object.values(TEST_CONFIG.directories);
for (const dir of directories) {
try {
const stat = Deno.statSync(dir);
if (!stat.isDirectory) {
console.error(`Test path is not a directory: ${dir}`);
return false;
}
} catch {
console.error(`Test directory not accessible: ${dir}`);
return false;
}
}
return true;
}