@@ -136,7 +136,7 @@ describe('InspectedElement', () => {
136
136
return inspectedElement ;
137
137
}
138
138
139
- it ( 'should inspect the currently selected element' , async done => {
139
+ it ( 'should inspect the currently selected element' , async ( ) => {
140
140
const Example = ( ) => {
141
141
const [ count ] = React . useState ( 1 ) ;
142
142
return count ;
@@ -170,11 +170,9 @@ describe('InspectedElement', () => {
170
170
"state": null,
171
171
}
172
172
` ) ;
173
-
174
- done ( ) ;
175
173
} ) ;
176
174
177
- it ( 'should have hasLegacyContext flag set to either "true" or "false" depending on which context API is used.' , async done => {
175
+ it ( 'should have hasLegacyContext flag set to either "true" or "false" depending on which context API is used.' , async ( ) => {
178
176
const contextData = {
179
177
bool : true ,
180
178
} ;
@@ -270,10 +268,9 @@ describe('InspectedElement', () => {
270
268
expect ( inspectedElement . context ) . not . toBe ( null ) ;
271
269
expect ( inspectedElement . hasLegacyContext ) . toBe ( shouldHaveLegacyContext ) ;
272
270
}
273
- done ( ) ;
274
271
} ) ;
275
272
276
- it ( 'should poll for updates for the currently selected element' , async done => {
273
+ it ( 'should poll for updates for the currently selected element' , async ( ) => {
277
274
const Example = ( ) => null ;
278
275
279
276
const container = document . createElement ( 'div' ) ;
@@ -312,11 +309,9 @@ describe('InspectedElement', () => {
312
309
"b": "def",
313
310
}
314
311
` ) ;
315
-
316
- done ( ) ;
317
312
} ) ;
318
313
319
- it ( 'should not re-render a function with hooks if it did not update since it was last inspected' , async done => {
314
+ it ( 'should not re-render a function with hooks if it did not update since it was last inspected' , async ( ) => {
320
315
let targetRenderCount = 0 ;
321
316
322
317
const Wrapper = ( { children} ) => children ;
@@ -377,11 +372,9 @@ describe('InspectedElement', () => {
377
372
"b": "def",
378
373
}
379
374
` ) ;
380
-
381
- done ( ) ;
382
375
} ) ;
383
376
384
- it ( 'should temporarily disable console logging when re-running a component to inspect its hooks' , async done => {
377
+ it ( 'should temporarily disable console logging when re-running a component to inspect its hooks' , async ( ) => {
385
378
let targetRenderCount = 0 ;
386
379
387
380
jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
@@ -422,11 +415,9 @@ describe('InspectedElement', () => {
422
415
expect ( console . info ) . toHaveBeenCalledTimes ( 1 ) ;
423
416
expect ( console . log ) . toHaveBeenCalledTimes ( 1 ) ;
424
417
expect ( console . warn ) . toHaveBeenCalledTimes ( 1 ) ;
425
-
426
- done ( ) ;
427
418
} ) ;
428
419
429
- it ( 'should support simple data types' , async done => {
420
+ it ( 'should support simple data types' , async ( ) => {
430
421
const Example = ( ) => null ;
431
422
432
423
const container = document . createElement ( 'div' ) ;
@@ -463,11 +454,9 @@ describe('InspectedElement', () => {
463
454
expect ( props . nan ) . toBeNaN ( ) ;
464
455
expect ( props . value_null ) . toBeNull ( ) ;
465
456
expect ( props . value_undefined ) . toBeUndefined ( ) ;
466
-
467
- done ( ) ;
468
457
} ) ;
469
458
470
- it ( 'should support complex data types' , async done => {
459
+ it ( 'should support complex data types' , async ( ) => {
471
460
const Immutable = require ( 'immutable' ) ;
472
461
473
462
const Example = ( ) => null ;
@@ -719,11 +708,9 @@ describe('InspectedElement', () => {
719
708
expect ( typed_array [ 2 ] ) . toBe ( 0 ) ;
720
709
expect ( typed_array [ meta . preview_long ] ) . toBe ( 'Int8Array(3) [100, -100, 0]' ) ;
721
710
expect ( typed_array [ meta . preview_short ] ) . toBe ( 'Int8Array(3)' ) ;
722
-
723
- done ( ) ;
724
711
} ) ;
725
712
726
- it ( 'should not consume iterables while inspecting' , async done => {
713
+ it ( 'should not consume iterables while inspecting' , async ( ) => {
727
714
const Example = ( ) => null ;
728
715
729
716
function * generator ( ) {
@@ -745,11 +732,9 @@ describe('InspectedElement', () => {
745
732
expect ( prop [ meta . type ] ) . toBe ( 'opaque_iterator' ) ;
746
733
expect ( prop [ meta . preview_long ] ) . toBe ( 'Generator' ) ;
747
734
expect ( prop [ meta . preview_short ] ) . toBe ( 'Generator' ) ;
748
-
749
- done ( ) ;
750
735
} ) ;
751
736
752
- it ( 'should support objects with no prototype' , async done => {
737
+ it ( 'should support objects with no prototype' , async ( ) => {
753
738
const Example = ( ) => null ;
754
739
755
740
const object = Object . create ( null ) ;
@@ -772,11 +757,9 @@ describe('InspectedElement', () => {
772
757
},
773
758
}
774
759
` ) ;
775
-
776
- done ( ) ;
777
760
} ) ;
778
761
779
- it ( 'should support objects with overridden hasOwnProperty' , async done => {
762
+ it ( 'should support objects with overridden hasOwnProperty' , async ( ) => {
780
763
const Example = ( ) => null ;
781
764
782
765
const object = {
@@ -795,11 +778,9 @@ describe('InspectedElement', () => {
795
778
// Our snapshot serializer relies on hasOwnProperty() for feature detection.
796
779
expect ( inspectedElement . props . object . name ) . toBe ( 'blah' ) ;
797
780
expect ( inspectedElement . props . object . hasOwnProperty ) . toBe ( true ) ;
798
-
799
- done ( ) ;
800
781
} ) ;
801
782
802
- it ( 'should support custom objects with enumerable properties and getters' , async done => {
783
+ it ( 'should support custom objects with enumerable properties and getters' , async ( ) => {
803
784
class CustomData {
804
785
_number = 42 ;
805
786
get number ( ) {
@@ -833,11 +814,9 @@ describe('InspectedElement', () => {
833
814
},
834
815
}
835
816
` ) ;
836
-
837
- done ( ) ;
838
817
} ) ;
839
818
840
- it ( 'should support objects with with inherited keys' , async done => {
819
+ it ( 'should support objects with with inherited keys' , async ( ) => {
841
820
const Example = ( ) => null ;
842
821
843
822
const base = Object . create ( Object . prototype , {
@@ -917,11 +896,9 @@ describe('InspectedElement', () => {
917
896
},
918
897
}
919
898
` ) ;
920
-
921
- done ( ) ;
922
899
} ) ;
923
900
924
- it ( 'should allow component prop value and value`s prototype has same name params.' , async done => {
901
+ it ( 'should allow component prop value and value`s prototype has same name params.' , async ( ) => {
925
902
const testData = Object . create (
926
903
{
927
904
a : undefined ,
@@ -973,11 +950,9 @@ describe('InspectedElement', () => {
973
950
},
974
951
}
975
952
` ) ;
976
-
977
- done ( ) ;
978
953
} ) ;
979
954
980
- it ( 'should not dehydrate nested values until explicitly requested' , async done => {
955
+ it ( 'should not dehydrate nested values until explicitly requested' , async ( ) => {
981
956
const Example = ( ) => {
982
957
const [ state ] = React . useState ( {
983
958
foo : {
@@ -1140,11 +1115,9 @@ describe('InspectedElement', () => {
1140
1115
},
1141
1116
]
1142
1117
` ) ;
1143
-
1144
- done ( ) ;
1145
1118
} ) ;
1146
1119
1147
- it ( 'should dehydrate complex nested values when requested' , async done => {
1120
+ it ( 'should dehydrate complex nested values when requested' , async ( ) => {
1148
1121
const Example = ( ) => null ;
1149
1122
1150
1123
const container = document . createElement ( 'div' ) ;
@@ -1208,11 +1181,9 @@ describe('InspectedElement', () => {
1208
1181
},
1209
1182
}
1210
1183
` ) ;
1211
-
1212
- done ( ) ;
1213
1184
} ) ;
1214
1185
1215
- it ( 'should include updates for nested values that were previously hydrated' , async done => {
1186
+ it ( 'should include updates for nested values that were previously hydrated' , async ( ) => {
1216
1187
const Example = ( ) => null ;
1217
1188
1218
1189
const container = document . createElement ( 'div' ) ;
@@ -1373,11 +1344,9 @@ describe('InspectedElement', () => {
1373
1344
},
1374
1345
}
1375
1346
` ) ;
1376
-
1377
- done ( ) ;
1378
1347
} ) ;
1379
1348
1380
- it ( 'should return a full update if a path is inspected for an object that has other pending changes' , async done => {
1349
+ it ( 'should return a full update if a path is inspected for an object that has other pending changes' , async ( ) => {
1381
1350
const Example = ( ) => null ;
1382
1351
1383
1352
const container = document . createElement ( 'div' ) ;
@@ -1510,11 +1479,9 @@ describe('InspectedElement', () => {
1510
1479
},
1511
1480
}
1512
1481
` ) ;
1513
-
1514
- done ( ) ;
1515
1482
} ) ;
1516
1483
1517
- it ( 'should not tear if hydration is requested after an update' , async done => {
1484
+ it ( 'should not tear if hydration is requested after an update' , async ( ) => {
1518
1485
const Example = ( ) => null ;
1519
1486
1520
1487
const container = document . createElement ( 'div' ) ;
@@ -1598,11 +1565,9 @@ describe('InspectedElement', () => {
1598
1565
},
1599
1566
}
1600
1567
` ) ;
1601
-
1602
- done ( ) ;
1603
1568
} ) ;
1604
1569
1605
- it ( 'should inspect hooks for components that only use context' , async done => {
1570
+ it ( 'should inspect hooks for components that only use context' , async ( ) => {
1606
1571
const Context = React . createContext ( true ) ;
1607
1572
const Example = ( ) => {
1608
1573
const value = React . useContext ( Context ) ;
@@ -1637,11 +1602,9 @@ describe('InspectedElement', () => {
1637
1602
"state": null,
1638
1603
}
1639
1604
` ) ;
1640
-
1641
- done ( ) ;
1642
1605
} ) ;
1643
1606
1644
- it ( 'should enable inspected values to be stored as global variables' , async done => {
1607
+ it ( 'should enable inspected values to be stored as global variables' , async ( ) => {
1645
1608
const Example = ( ) => null ;
1646
1609
1647
1610
const nestedObject = {
@@ -1698,11 +1661,9 @@ describe('InspectedElement', () => {
1698
1661
jest . runOnlyPendingTimers ( ) ;
1699
1662
expect ( console . log ) . toHaveBeenCalledWith ( '$reactTemp1' ) ;
1700
1663
expect ( global . $reactTemp1 ) . toBe ( nestedObject . a . b ) ;
1701
-
1702
- done ( ) ;
1703
1664
} ) ;
1704
1665
1705
- it ( 'should enable inspected values to be copied to the clipboard' , async done => {
1666
+ it ( 'should enable inspected values to be copied to the clipboard' , async ( ) => {
1706
1667
const Example = ( ) => null ;
1707
1668
1708
1669
const nestedObject = {
@@ -1761,11 +1722,9 @@ describe('InspectedElement', () => {
1761
1722
expect ( global . mockClipboardCopy ) . toHaveBeenCalledWith (
1762
1723
JSON . stringify ( nestedObject . a . b ) ,
1763
1724
) ;
1764
-
1765
- done ( ) ;
1766
1725
} ) ;
1767
1726
1768
- it ( 'should enable complex values to be copied to the clipboard' , async done => {
1727
+ it ( 'should enable complex values to be copied to the clipboard' , async ( ) => {
1769
1728
const Immutable = require ( 'immutable' ) ;
1770
1729
1771
1730
const Example = ( ) => null ;
@@ -1856,11 +1815,9 @@ describe('InspectedElement', () => {
1856
1815
expect ( global . mockClipboardCopy ) . toHaveBeenCalledWith (
1857
1816
JSON . stringify ( { 0 : 100 , 1 : - 100 , 2 : 0 } ) ,
1858
1817
) ;
1859
-
1860
- done ( ) ;
1861
1818
} ) ;
1862
1819
1863
- it ( 'should display complex values of useDebugValue' , async done => {
1820
+ it ( 'should display complex values of useDebugValue' , async ( ) => {
1864
1821
const container = document . createElement ( 'div' ) ;
1865
1822
1866
1823
function useDebuggableHook ( ) {
@@ -1899,12 +1856,10 @@ describe('InspectedElement', () => {
1899
1856
},
1900
1857
]
1901
1858
` ) ;
1902
-
1903
- done ( ) ;
1904
1859
} ) ;
1905
1860
1906
1861
describe ( '$r' , ( ) => {
1907
- it ( 'should support function components' , async done => {
1862
+ it ( 'should support function components' , async ( ) => {
1908
1863
const Example = ( ) => {
1909
1864
const [ count ] = React . useState ( 1 ) ;
1910
1865
return count ;
@@ -1935,11 +1890,9 @@ describe('InspectedElement', () => {
1935
1890
"type": [Function],
1936
1891
}
1937
1892
` ) ;
1938
-
1939
- done ( ) ;
1940
1893
} ) ;
1941
1894
1942
- it ( 'should support memoized function components' , async done => {
1895
+ it ( 'should support memoized function components' , async ( ) => {
1943
1896
const Example = React . memo ( function Example ( props ) {
1944
1897
const [ count ] = React . useState ( 1 ) ;
1945
1898
return count ;
@@ -1970,11 +1923,9 @@ describe('InspectedElement', () => {
1970
1923
"type": [Function],
1971
1924
}
1972
1925
` ) ;
1973
-
1974
- done ( ) ;
1975
1926
} ) ;
1976
1927
1977
- it ( 'should support forward refs' , async done => {
1928
+ it ( 'should support forward refs' , async ( ) => {
1978
1929
const Example = React . forwardRef ( function Example ( props , ref ) {
1979
1930
const [ count ] = React . useState ( 1 ) ;
1980
1931
return count ;
@@ -2005,11 +1956,9 @@ describe('InspectedElement', () => {
2005
1956
"type": [Function],
2006
1957
}
2007
1958
` ) ;
2008
-
2009
- done ( ) ;
2010
1959
} ) ;
2011
1960
2012
- it ( 'should support class components' , async done => {
1961
+ it ( 'should support class components' , async ( ) => {
2013
1962
class Example extends React . Component {
2014
1963
state = {
2015
1964
count : 0 ,
@@ -2027,18 +1976,16 @@ describe('InspectedElement', () => {
2027
1976
await inspectElementAtIndex ( 0 ) ;
2028
1977
2029
1978
expect ( global . $r . props ) . toMatchInlineSnapshot ( `
2030
- Object {
2031
- "a": 1,
2032
- "b": "abc",
2033
- }
2034
- ` ) ;
1979
+ Object {
1980
+ "a": 1,
1981
+ "b": "abc",
1982
+ }
1983
+ ` ) ;
2035
1984
expect ( global . $r . state ) . toMatchInlineSnapshot ( `
2036
- Object {
2037
- "count": 0,
2038
- }
2039
- ` ) ;
2040
-
2041
- done ( ) ;
1985
+ Object {
1986
+ "count": 0,
1987
+ }
1988
+ ` ) ;
2042
1989
} ) ;
2043
1990
} ) ;
2044
1991
0 commit comments