@@ -71,8 +71,10 @@ describe('InspectedElement', () => {
71
71
. TreeContextController ;
72
72
73
73
// Used by inspectElementAtIndex() helper function
74
- testRendererInstance = TestRenderer . create ( null , {
75
- unstable_isConcurrent : true ,
74
+ utils . act ( ( ) => {
75
+ testRendererInstance = TestRenderer . create ( null , {
76
+ unstable_isConcurrent : true ,
77
+ } ) ;
76
78
} ) ;
77
79
78
80
errorBoundaryInstance = null ;
@@ -299,9 +301,14 @@ describe('InspectedElement', () => {
299
301
// from props like defaultSelectedElementID and it's easier to reset here than
300
302
// to read the TreeDispatcherContext and update the selected ID that way.
301
303
// We're testing the inspected values here, not the context wiring, so that's ok.
302
- testRendererInstance = TestRenderer . create ( null , {
303
- unstable_isConcurrent : true ,
304
- } ) ;
304
+ utils . withErrorsOrWarningsIgnored (
305
+ [ 'An update to %s inside a test was not wrapped in act' ] ,
306
+ ( ) => {
307
+ testRendererInstance = TestRenderer . create ( null , {
308
+ unstable_isConcurrent : true ,
309
+ } ) ;
310
+ } ,
311
+ ) ;
305
312
306
313
const inspectedElement = await inspectElementAtIndex ( index ) ;
307
314
@@ -460,9 +467,14 @@ describe('InspectedElement', () => {
460
467
// The backend still thinks the most recently-inspected element is still cached,
461
468
// so the frontend needs to tell it to resend a full value.
462
469
// We can verify this by asserting that the component is re-rendered again.
463
- testRendererInstance = TestRenderer . create ( null , {
464
- unstable_isConcurrent : true ,
465
- } ) ;
470
+ utils . withErrorsOrWarningsIgnored (
471
+ [ 'An update to %s inside a test was not wrapped in act' ] ,
472
+ ( ) => {
473
+ testRendererInstance = TestRenderer . create ( null , {
474
+ unstable_isConcurrent : true ,
475
+ } ) ;
476
+ } ,
477
+ ) ;
466
478
467
479
const {
468
480
clearCacheForTests,
@@ -2024,9 +2036,14 @@ describe('InspectedElement', () => {
2024
2036
// from props like defaultSelectedElementID and it's easier to reset here than
2025
2037
// to read the TreeDispatcherContext and update the selected ID that way.
2026
2038
// We're testing the inspected values here, not the context wiring, so that's ok.
2027
- testRendererInstance = TestRenderer . create ( null , {
2028
- unstable_isConcurrent : true ,
2029
- } ) ;
2039
+ utils . withErrorsOrWarningsIgnored (
2040
+ [ 'An update to %s inside a test was not wrapped in act' ] ,
2041
+ ( ) => {
2042
+ testRendererInstance = TestRenderer . create ( null , {
2043
+ unstable_isConcurrent : true ,
2044
+ } ) ;
2045
+ } ,
2046
+ ) ;
2030
2047
2031
2048
// Select/inspect the same element again
2032
2049
inspectedElement = await inspectElementAtIndex ( 0 ) ;
@@ -2743,11 +2760,15 @@ describe('InspectedElement', () => {
2743
2760
0 ,
2744
2761
) : any ) : number ) ;
2745
2762
const inspect = index => {
2746
- // HACK: Recreate TestRenderer instance so we can inspect different
2747
- // elements
2748
- testRendererInstance = TestRenderer . create ( null , {
2749
- unstable_isConcurrent : true ,
2750
- } ) ;
2763
+ // HACK: Recreate TestRenderer instance so we can inspect different elements
2764
+ utils . withErrorsOrWarningsIgnored (
2765
+ [ 'An update to %s inside a test was not wrapped in act' ] ,
2766
+ ( ) => {
2767
+ testRendererInstance = TestRenderer . create ( null , {
2768
+ unstable_isConcurrent : true ,
2769
+ } ) ;
2770
+ } ,
2771
+ ) ;
2751
2772
return inspectElementAtIndex ( index ) ;
2752
2773
} ;
2753
2774
const toggleError = async forceError => {
0 commit comments