-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.setup.ts
More file actions
24 lines (23 loc) · 856 Bytes
/
jest.setup.ts
File metadata and controls
24 lines (23 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Extends Jest's expect() with DOM-specific matchers:
// toBeInTheDocument(), toHaveTextContent(), toBeVisible(), etc.
import "@testing-library/jest-dom";
// Suppress the React "not wrapped in act()" console.error for async state
// updates that settle via microtasks (resolved Promise mocks). This is a
// known React 19 + RTL quirk: fetch mocks resolve after render()'s act()
// boundary closes, causing warnings even though waitFor() still passes.
// Real act() violations (synchronous missed wraps) still surface as failures.
const originalError = console.error.bind(console);
beforeAll(() => {
console.error = (...args: unknown[]) => {
if (
typeof args[0] === "string" &&
args[0].includes("not wrapped in act(")
) {
return;
}
originalError(...args);
};
});
afterAll(() => {
console.error = originalError;
});