@wgtechlabs/log-engine
Version:
A lightweight, security-first logging utility with automatic data redaction for Node.js applications - the first logging library with built-in PII protection.
51 lines • 1.77 kB
TypeScript
/**
* Wait for a file to exist with optimized polling
*/
export declare function waitForFile(filePath: string, timeoutMs?: number): Promise<void>;
/**
* Wait for multiple files to exist with parallel checking
*/
export declare function waitForFiles(filePaths: string[], timeoutMs?: number): Promise<void>;
/**
* Wait for a file to have specific content with optimized polling
*/
export declare function waitForFileContent(filePath: string, expectedContent: string | RegExp, timeoutMs?: number): Promise<void>;
/**
* Wait for a directory to be empty with faster polling
*/
export declare function waitForDirectoryEmpty(dirPath: string, timeoutMs?: number): Promise<void>;
/**
* Safely remove a file with optimized retry logic
*/
export declare function safeRemoveFile(filePath: string, maxRetries?: number): Promise<void>;
/**
* Safely clean up a directory with retry logic
*/
export declare function safeCleanupDirectory(dirPath: string): Promise<void>;
/**
* Enhanced mock HTTP handler with faster timeouts and better error handling
*/
export declare class MockHttpHandler {
private requests;
private pendingPromises;
private timeoutIds;
addRequest(url: string, options: any): void;
getRequests(): {
url: string;
options: any;
}[];
waitForRequests(count?: number, timeoutMs?: number): Promise<void>;
clear(): void;
}
/**
* Create a test timeout that fails fast instead of hanging
*/
export declare function createTestTimeout(timeoutMs?: number): {
promise: Promise<never>;
cancel: () => void;
};
/**
* Race a promise against a timeout for fail-fast behavior
*/
export declare function withTimeout<T>(promise: Promise<T>, timeoutMs?: number): Promise<T>;
//# sourceMappingURL=async-test-utils.d.ts.map