/** * Setup and Initialization Utilities - TypeScript ES Module Implementation * * This module provides setup functionality for the qtests framework. * The setup function modifies global Node.js behavior to enable automatic * stub resolution, which is essential for seamless testing. * * Design philosophy: * - Explicit setup to avoid unintended side effects * - Clear separation of setup from other utilities * - Comprehensive error handling and logging * - Safe to call multiple times * * Why explicit setup is necessary: * 1. Modifying Node.js module resolution is a global side effect * 2. Users should explicitly opt-in to this behavior modification * 3. Setup timing is critical - must happen before module requires * 4. Clear separation makes it obvious when global behavior is being changed * * Alternative approaches considered: * - Automatic setup on require: Rejected due to hidden side effects * - Setup in individual utilities: Rejected due to timing complexity * - Multiple setup functions: Rejected for simplicity * * Current approach benefits: * - Clear, explicit user intent required * - Single point of global behavior modification * - Easy to understand and debug * - Follows principle of least surprise */ /** * Initialize qtests framework with automatic stub resolution * * This function modifies Node.js module resolution to automatically * substitute stub implementations for real modules during testing. * * Implementation rationale: * 1. Function wrapper provides explicit call syntax for users * 2. Lazy loading of setup module prevents accidental side effects * 3. Error handling ensures setup failures are clearly reported * 4. Logging provides visibility into setup process for debugging * * Why a function wrapper instead of direct require: * - Makes setup intention explicit in user code * - Allows error handling and logging at the API level * - Provides a clear point for future enhancement (parameters, options) * - Follows common Node.js patterns for initialization functions * * Critical timing requirement: * This function MUST be called before requiring any modules that need stubbing. * If axios or winston are required before setup(), they will be the real modules. */ declare function setup(): Promise; export { setup }; //# sourceMappingURL=setup.d.ts.map