UNPKG

ruch

Version:

Revolutionary React TypeScript CLI with hexagonal architecture & AI-powered development assistance. Create maintainable, scalable applications with domain-driven design and integrated AI tooling.

46 lines (38 loc) 978 B
// Global Test Setup with MSW // This file configures testing environment with Mock Service Worker import '@testing-library/jest-dom'; import { server } from './mocks/server'; // Enable MSW server before all tests beforeAll(() => { server.listen({ onUnhandledRequest: 'warn' }); }); // Reset handlers between tests to ensure test isolation afterEach(() => { server.resetHandlers(); }); // Close server after all tests afterAll(() => { server.close(); }); // Global test utilities global.ResizeObserver = class ResizeObserver { observe() {} unobserve() {} disconnect() {} }; // Mock console.error for cleaner test output const originalError = console.error; beforeAll(() => { console.error = (...args: any[]) => { if ( typeof args[0] === 'string' && args[0].includes('Warning: ReactDOM.render is deprecated') ) { return; } originalError.call(console, ...args); }; }); afterAll(() => { console.error = originalError; });