Massive v2 rewrite

This commit is contained in:
Caileb 2025-08-02 15:34:04 -05:00
parent 1025f3b523
commit 5f1328f626
77 changed files with 28105 additions and 3542 deletions

43
.tests/teardown.js Normal file
View file

@ -0,0 +1,43 @@
// Jest teardown file - runs after all tests complete
// This helps prevent async operations from continuing after Jest environment teardown
// Global teardown to ensure clean test environment shutdown
module.exports = async () => {
// Clear all timers first
if (typeof global.clearAllTimers === 'function') {
global.clearAllTimers();
}
// Clear any pending setImmediate calls
if (global.pendingImmediates) {
global.pendingImmediates.forEach(id => clearImmediate(id));
global.pendingImmediates.clear();
}
// Force close any remaining handles
if (process._getActiveHandles) {
const handles = process._getActiveHandles();
handles.forEach(handle => {
if (handle && typeof handle.close === 'function') {
try {
handle.close();
} catch (e) {
// Ignore errors during forced cleanup
}
}
});
}
// Force garbage collection if available
if (global.gc) {
global.gc();
}
// Add a small delay to allow any pending async operations to complete
await new Promise(resolve => setTimeout(resolve, 50));
// Clear any remaining console overrides
if (global.originalConsole) {
Object.assign(console, global.originalConsole);
}
};