/**
 * Async test helpers for preventing hanging tests
 * Provides utilities for timeouts, retries, and cleanup
 */
/**
 * Timeout configuration for different test types
 */
export declare const TEST_TIMEOUTS: {
    readonly unit: 3000;
    readonly integration: 10000;
    readonly e2e: 30000;
    readonly default: 5000;
};
/**
 * Promise with timeout utility
 * Prevents tests from hanging indefinitely
 */
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs?: number, errorMessage?: string): Promise<T>;
/**
 * Retry utility for flaky operations
 * Useful for tests that occasionally fail due to timing issues
 */
export declare function retry<T>(fn: () => Promise<T>, options?: {
    maxRetries?: number;
    delay?: number;
    backoff?: boolean;
    timeout?: number;
}): Promise<T>;
/**
 * Wait for a condition to be true
 * Useful for waiting for async state changes
 */
export declare function waitFor(condition: () => boolean | Promise<boolean>, options?: {
    timeout?: number;
    interval?: number;
    errorMessage?: string;
}): Promise<void>;
/**
 * Create a deferred promise for testing async flows
 */
export declare function createDeferred<T>(): {
    promise: Promise<T>;
    resolve: (value: T) => void;
    reject: (error: Error) => void;
};
/**
 * Test fixture for managing async resources
 * Ensures cleanup even if test fails
 */
export declare class AsyncTestFixture {
    private cleanupFns;
    private activeTimers;
    private activeIntervals;
    /**
     * Register a cleanup function
     */
    addCleanup(fn: () => void | Promise<void>): void;
    /**
     * Create a timer that will be automatically cleaned up
     */
    setTimeout(fn: () => void, delay: number): NodeJS.Timeout;
    /**
     * Create an interval that will be automatically cleaned up
     */
    setInterval(fn: () => void, delay: number): NodeJS.Timeout;
    /**
     * Clear a timer
     */
    clearTimeout(timer: NodeJS.Timeout): void;
    /**
     * Clear an interval
     */
    clearInterval(interval: NodeJS.Timeout): void;
    /**
     * Run all cleanup functions
     */
    cleanup(): Promise<void>;
}
/**
 * Mock timer utilities for deterministic async tests
 */
export declare const mockTimers: {
    /**
     * Use fake timers and return cleanup function
     */
    useFakeTimers(): () => void;
    /**
     * Advance timers by time and flush promises
     */
    advanceTimersByTime(ms: number): Promise<void>;
    /**
     * Run all pending timers and flush promises
     */
    runAllTimers(): Promise<void>;
    /**
     * Run only pending timers (not recursive) and flush promises
     */
    runOnlyPendingTimers(): Promise<void>;
};
/**
 * Flush all pending promises
 * Useful for ensuring async operations complete
 */
export declare function flushPromises(): Promise<void>;
/**
 * Create a test timeout guard
 * Automatically fails test if it takes too long
 */
export declare function createTimeoutGuard(timeoutMs?: number): {
    cancel: () => void;
};
/**
 * Wrap an async test with automatic timeout
 */
export declare function withTestTimeout<T>(testFn: () => Promise<T>, timeoutMs?: number): () => Promise<T>;
//# sourceMappingURL=async-helpers.d.ts.map