Files
cyberyan_linkedin_search/frontend/src/test/setup.ts
T

15 lines
566 B
TypeScript
Raw Normal View History

2026-09-04 12:52:21 +03:30
import { cleanup } from '@testing-library/react';
import { afterEach } from 'vitest';
import '@testing-library/jest-dom/vitest';
// vitest.config.ts intentionally leaves `test.globals` off (test files import
// describe/it/expect explicitly), so Testing Library's own auto-cleanup -
// which only registers itself when it detects a *global* `afterEach` - never
// fires on its own. Without this, unmounted DOM from one `it()` block leaks
// into the next within the same file, and every query starts matching
// duplicate nodes.
afterEach(() => {
cleanup();
});