-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Expand file tree
/
Copy pathindex.ts
More file actions
36 lines (31 loc) · 922 Bytes
/
index.ts
File metadata and controls
36 lines (31 loc) · 922 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
25
26
27
28
29
30
31
32
33
34
35
36
import "jest-canvas-mock";
import { toHaveNoViolations } from "jest-axe";
expect.extend(toHaveNoViolations);
// Suppress act() warnings from floating-ui library
const originalError = console.error;
beforeAll(() => {
console.error = (...args) => {
// Convert all arguments to a single string for checking
const fullMessage = args
.map((arg) =>
typeof arg === "string"
? arg
: arg instanceof Error
? arg.message
: String(arg),
)
.join(" ");
// Suppress floating-ui act warnings - these come from @floating-ui/react-dom
// internally using flushSync, which is expected behavior
if (
fullMessage.includes("withFloating(PopperComponent)") &&
fullMessage.includes("not wrapped in act")
) {
return;
}
originalError.call(console, ...args);
};
});
afterAll(() => {
console.error = originalError;
});