/** * Enhanced Test Isolation Framework * * Provides test isolation utilities with comprehensive resource management, * memory tracking, and performance monitoring. */ import { EventEmitter } from 'events'; export interface IsolationState { [key: string]: any; stack: (() => void)[]; } export interface IsolationCleanup { (): Promise; } export interface ResourceTracker { type: string; id: string; cleanup: IsolationCleanup; createdAt: number; } export interface TestMetrics { testName: string; startTime: number; memoryBefore: NodeJS.MemoryUsage; resourcesAllocated: number; resourcesCleaned: number; errors: string[]; endTime?: number; memoryAfter?: NodeJS.MemoryUsage; duration?: number; } export declare class TestIsolationManager extends EventEmitter { private state; private cleanupTasks; private allocatedResources; private currentTest; private testHistory; private maxHistoryLength; private cleanupTimeoutMs; constructor(); reset(): void; addCleanup(cleanup: () => void): void; addCleanupTask(cleanup: IsolationCleanup): void; trackResource(type: string, id: string, cleanup: IsolationCleanup): void; untrackResource(type: string, id: string): boolean; startMemoryTracking(testName?: string): void; measure(label: string): NodeJS.MemoryUsage; runCleanup(): Promise; endMemoryTracking(): TestMetrics | null; getCurrentTest(): TestMetrics | null; getTestHistory(): TestMetrics[]; clearHistory(): void; getState(): IsolationState; setState(newState: Partial): void; getResourceCount(): number; getResources(): ResourceTracker[]; } export declare const testIsolation: TestIsolationManager; export declare const memoryTracker: { startTracking(): void; measure(label: string): NodeJS.MemoryUsage; }; export declare class SessionCleaner { private sessionStore; constructor(sessionStore: { sessions: Set; delete: (id: string) => Promise; }); cleanupSessions(sessionIds?: string[]): Promise; } export declare const createTestIsolation: () => TestIsolationManager; export declare const withIsolation: (fn: (manager: TestIsolationManager) => Promise) => Promise; export default TestIsolationManager; //# sourceMappingURL=testIsolationFramework.d.ts.map