Skip to main content
Glama
jest.setup.js1.07 kB
/** * Jest setup for performance tests * Ensures proper cleanup of timers and resources */ // Store references to timers for cleanup global.__timers = []; // Override setInterval to track timers const originalSetInterval = global.setInterval; global.setInterval = function (callback, delay, ...args) { const timer = originalSetInterval(callback, delay, ...args); global.__timers.push(timer); return timer; }; // Override setTimeout to track timers const originalSetTimeout = global.setTimeout; global.setTimeout = function (callback, delay, ...args) { const timer = originalSetTimeout(callback, delay, ...args); global.__timers.push(timer); return timer; }; // Clean up all timers after each test afterEach(() => { // Clear all timers global.__timers.forEach((timer) => { clearInterval(timer); clearTimeout(timer); }); global.__timers = []; }); // Ensure process exits cleanly afterAll(() => { // Final cleanup global.__timers.forEach((timer) => { clearInterval(timer); clearTimeout(timer); }); global.__timers = []; });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/docdyhr/mcp-wordpress'

If you have feedback or need assistance with the MCP directory API, please join our Discord server