File tree Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Expand file tree Collapse file tree 1 file changed +13
-9
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,20 @@ expect.extend(toHaveNoViolations);
7
7
const originalError = console . error ;
8
8
beforeAll ( ( ) => {
9
9
console . error = ( ...args ) => {
10
- // Check if any of the arguments contains the floating-ui act warning
11
- const hasFloatingActWarning = args . some (
12
- ( arg ) =>
13
- typeof arg === "string" &&
14
- arg . includes (
15
- "An update to withFloating(PopperComponent) inside a test was not wrapped in act" ,
16
- ) ,
17
- ) ;
10
+ // Check the first argument ( the error message)
11
+ const firstArg = args [ 0 ] ;
12
+ const firstArgStr =
13
+ typeof firstArg === "string"
14
+ ? firstArg
15
+ : firstArg instanceof Error
16
+ ? firstArg . message
17
+ : String ( firstArg ) ;
18
18
19
- if ( hasFloatingActWarning ) {
19
+ // Suppress floating-ui act warnings
20
+ if (
21
+ firstArgStr . includes ( "An update to withFloating(PopperComponent)" ) &&
22
+ firstArgStr . includes ( "inside a test was not wrapped in act" )
23
+ ) {
20
24
return ;
21
25
}
22
26
You can’t perform that action at this time.
0 commit comments