import * as path from 'path'; import * as dotenv from 'dotenv'; // Load test environment variables before any tests run dotenv.config({ path: path.resolve(__dirname, '../../.env.test') }); // Set test environment process.env.NODE_ENV = 'test'; process.env.APP_ENV = 'test'; // Increase timeout for E2E tests jest.setTimeout(30000); // Add custom matchers if needed expect.extend({ toBeValidUUID(received: string) { const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i; const pass = uuidRegex.test(received); return { pass, message: () => pass ? `expected ${received} not to be a valid UUID` : `expected ${received} to be a valid UUID`, }; }, }); // Extend Jest types declare global { namespace jest { interface Matchers { toBeValidUUID(): R; } } }