@@ -1777,7 +1777,7 @@ describe('ReactHooksWithNoopRenderer', () => {
1777
1777
} , [ props . count ] ) ;
1778
1778
return < Text text = { 'Count: ' + count } /> ;
1779
1779
}
1780
- expect ( ( ) =>
1780
+ expect ( ( ) => {
1781
1781
act ( ( ) => {
1782
1782
ReactNoop . render ( < Counter count = { 0 } /> , ( ) =>
1783
1783
Scheduler . unstable_yieldValue ( 'Sync effect' ) ,
@@ -1787,8 +1787,8 @@ describe('ReactHooksWithNoopRenderer', () => {
1787
1787
'Sync effect' ,
1788
1788
] ) ;
1789
1789
expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'Count: (empty)' ) ] ) ;
1790
- } ) ,
1791
- ) . toErrorDev ( 'flushSync was called from inside a lifecycle method' ) ;
1790
+ } ) ;
1791
+ } ) . toErrorDev ( 'flushSync was called from inside a lifecycle method' ) ;
1792
1792
expect ( ReactNoop . getChildren ( ) ) . toEqual ( [ span ( 'Count: 0' ) ] ) ;
1793
1793
} ) ;
1794
1794
@@ -2648,32 +2648,32 @@ describe('ReactHooksWithNoopRenderer', () => {
2648
2648
}
2649
2649
2650
2650
const root1 = ReactNoop . createRoot ( ) ;
2651
- expect ( ( ) =>
2651
+ expect ( ( ) => {
2652
2652
act ( ( ) => {
2653
2653
root1 . render ( < App return = { 17 } /> ) ;
2654
- } ) ,
2655
- ) . toErrorDev ( [
2654
+ } ) ;
2655
+ } ) . toErrorDev ( [
2656
2656
'Warning: useEffect must not return anything besides a ' +
2657
2657
'function, which is used for clean-up. You returned: 17' ,
2658
2658
] ) ;
2659
2659
2660
2660
const root2 = ReactNoop . createRoot ( ) ;
2661
- expect ( ( ) =>
2661
+ expect ( ( ) => {
2662
2662
act ( ( ) => {
2663
2663
root2 . render ( < App return = { null } /> ) ;
2664
- } ) ,
2665
- ) . toErrorDev ( [
2664
+ } ) ;
2665
+ } ) . toErrorDev ( [
2666
2666
'Warning: useEffect must not return anything besides a ' +
2667
2667
'function, which is used for clean-up. You returned null. If your ' +
2668
2668
'effect does not require clean up, return undefined (or nothing).' ,
2669
2669
] ) ;
2670
2670
2671
2671
const root3 = ReactNoop . createRoot ( ) ;
2672
- expect ( ( ) =>
2672
+ expect ( ( ) => {
2673
2673
act ( ( ) => {
2674
2674
root3 . render ( < App return = { Promise . resolve ( ) } /> ) ;
2675
- } ) ,
2676
- ) . toErrorDev ( [
2675
+ } ) ;
2676
+ } ) . toErrorDev ( [
2677
2677
'Warning: useEffect must not return anything besides a ' +
2678
2678
'function, which is used for clean-up.\n\n' +
2679
2679
'It looks like you wrote useEffect(async () => ...) or returned a Promise.' ,
@@ -3052,32 +3052,32 @@ describe('ReactHooksWithNoopRenderer', () => {
3052
3052
}
3053
3053
3054
3054
const root1 = ReactNoop . createRoot ( ) ;
3055
- expect ( ( ) =>
3055
+ expect ( ( ) => {
3056
3056
act ( ( ) => {
3057
3057
root1 . render ( < App return = { 17 } /> ) ;
3058
- } ) ,
3059
- ) . toErrorDev ( [
3058
+ } ) ;
3059
+ } ) . toErrorDev ( [
3060
3060
'Warning: useInsertionEffect must not return anything besides a ' +
3061
3061
'function, which is used for clean-up. You returned: 17' ,
3062
3062
] ) ;
3063
3063
3064
3064
const root2 = ReactNoop . createRoot ( ) ;
3065
- expect ( ( ) =>
3065
+ expect ( ( ) => {
3066
3066
act ( ( ) => {
3067
3067
root2 . render ( < App return = { null } /> ) ;
3068
- } ) ,
3069
- ) . toErrorDev ( [
3068
+ } ) ;
3069
+ } ) . toErrorDev ( [
3070
3070
'Warning: useInsertionEffect must not return anything besides a ' +
3071
3071
'function, which is used for clean-up. You returned null. If your ' +
3072
3072
'effect does not require clean up, return undefined (or nothing).' ,
3073
3073
] ) ;
3074
3074
3075
3075
const root3 = ReactNoop . createRoot ( ) ;
3076
- expect ( ( ) =>
3076
+ expect ( ( ) => {
3077
3077
act ( ( ) => {
3078
3078
root3 . render ( < App return = { Promise . resolve ( ) } /> ) ;
3079
- } ) ,
3080
- ) . toErrorDev ( [
3079
+ } ) ;
3080
+ } ) . toErrorDev ( [
3081
3081
'Warning: useInsertionEffect must not return anything besides a ' +
3082
3082
'function, which is used for clean-up.\n\n' +
3083
3083
'It looks like you wrote useInsertionEffect(async () => ...) or returned a Promise.' ,
@@ -3104,11 +3104,11 @@ describe('ReactHooksWithNoopRenderer', () => {
3104
3104
}
3105
3105
3106
3106
const root = ReactNoop . createRoot ( ) ;
3107
- expect ( ( ) =>
3107
+ expect ( ( ) => {
3108
3108
act ( ( ) => {
3109
3109
root . render ( < App /> ) ;
3110
- } ) ,
3111
- ) . toErrorDev ( [ 'Warning: useInsertionEffect must not schedule updates.' ] ) ;
3110
+ } ) ;
3111
+ } ) . toErrorDev ( [ 'Warning: useInsertionEffect must not schedule updates.' ] ) ;
3112
3112
3113
3113
expect ( ( ) => {
3114
3114
act ( ( ) => {
@@ -3359,32 +3359,32 @@ describe('ReactHooksWithNoopRenderer', () => {
3359
3359
}
3360
3360
3361
3361
const root1 = ReactNoop . createRoot ( ) ;
3362
- expect ( ( ) =>
3362
+ expect ( ( ) => {
3363
3363
act ( ( ) => {
3364
3364
root1 . render ( < App return = { 17 } /> ) ;
3365
- } ) ,
3366
- ) . toErrorDev ( [
3365
+ } ) ;
3366
+ } ) . toErrorDev ( [
3367
3367
'Warning: useLayoutEffect must not return anything besides a ' +
3368
3368
'function, which is used for clean-up. You returned: 17' ,
3369
3369
] ) ;
3370
3370
3371
3371
const root2 = ReactNoop . createRoot ( ) ;
3372
- expect ( ( ) =>
3372
+ expect ( ( ) => {
3373
3373
act ( ( ) => {
3374
3374
root2 . render ( < App return = { null } /> ) ;
3375
- } ) ,
3376
- ) . toErrorDev ( [
3375
+ } ) ;
3376
+ } ) . toErrorDev ( [
3377
3377
'Warning: useLayoutEffect must not return anything besides a ' +
3378
3378
'function, which is used for clean-up. You returned null. If your ' +
3379
3379
'effect does not require clean up, return undefined (or nothing).' ,
3380
3380
] ) ;
3381
3381
3382
3382
const root3 = ReactNoop . createRoot ( ) ;
3383
- expect ( ( ) =>
3383
+ expect ( ( ) => {
3384
3384
act ( ( ) => {
3385
3385
root3 . render ( < App return = { Promise . resolve ( ) } /> ) ;
3386
- } ) ,
3387
- ) . toErrorDev ( [
3386
+ } ) ;
3387
+ } ) . toErrorDev ( [
3388
3388
'Warning: useLayoutEffect must not return anything besides a ' +
3389
3389
'function, which is used for clean-up.\n\n' +
3390
3390
'It looks like you wrote useLayoutEffect(async () => ...) or returned a Promise.' ,
0 commit comments