Skip to main content
Glama
jest.afterEnv.ts1.32 kB
import { jest } from '@jest/globals'; // Clean up after each test afterEach(async () => { // Clear all mocks jest.clearAllMocks(); // Reset modules jest.resetModules(); // Clear any timers jest.clearAllTimers(); // Clean up any test data or connections await cleanupTestResources(); }); // Clean up after all tests afterAll(async () => { // Final cleanup await cleanupTestResources(); // Use real timers for cleanup jest.useRealTimers(); }); async function cleanupTestResources(): Promise<void> { // Clean up Redis connections if any test created them try { const redis = require('../../src/database/redis'); if (redis.redis && typeof redis.redis.disconnect === 'function') { await redis.redis.disconnect(); } } catch (error) { // Ignore cleanup errors in tests } // Clean up database connections if any test created them try { const db = require('../../src/database/connection'); if (db.prisma && typeof db.prisma.$disconnect === 'function') { await db.prisma.$disconnect(); } } catch (error) { // Ignore cleanup errors in tests } // Clean up any other test resources try { // Close any open file descriptors if (global.gc) { global.gc(); } } catch (error) { // Ignore cleanup errors in tests } }

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/perfecxion-ai/secure-mcp'

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