@@ -7,6 +7,7 @@ let waitFor;
7
7
let waitForAll ;
8
8
let waitForThrow ;
9
9
let assertLog ;
10
+ let assertConsoleErrorDev ;
10
11
let act ;
11
12
12
13
let fakeModuleCache ;
@@ -34,6 +35,7 @@ describe('ReactLazy', () => {
34
35
waitForAll = InternalTestUtils . waitForAll ;
35
36
waitForThrow = InternalTestUtils . waitForThrow ;
36
37
assertLog = InternalTestUtils . assertLog ;
38
+ assertConsoleErrorDev = InternalTestUtils . assertConsoleErrorDev ;
37
39
act = InternalTestUtils . act ;
38
40
39
41
fakeModuleCache = new Map ( ) ;
@@ -205,8 +207,6 @@ describe('ReactLazy', () => {
205
207
} ) ;
206
208
207
209
it ( 'does not support arbitrary promises, only module objects' , async ( ) => {
208
- spyOnDev ( console , 'error' ) . mockImplementation ( ( ) => { } ) ;
209
-
210
210
const LazyText = lazy ( async ( ) => Text ) ;
211
211
212
212
const root = ReactTestRenderer . create ( null , {
@@ -228,13 +228,11 @@ describe('ReactLazy', () => {
228
228
229
229
expect ( error . message ) . toMatch ( 'Element type is invalid' ) ;
230
230
assertLog ( [ 'Loading...' ] ) ;
231
+ assertConsoleErrorDev ( [
232
+ 'Expected the result of a dynamic import() call' ,
233
+ 'Expected the result of a dynamic import() call' ,
234
+ ] ) ;
231
235
expect ( root ) . not . toMatchRenderedOutput ( 'Hi' ) ;
232
- if ( __DEV__ ) {
233
- expect ( console . error ) . toHaveBeenCalledTimes ( 2 ) ;
234
- expect ( console . error . mock . calls [ 0 ] [ 0 ] ) . toContain (
235
- 'Expected the result of a dynamic import() call' ,
236
- ) ;
237
- }
238
236
} ) ;
239
237
240
238
it ( 'throws if promise rejects' , async ( ) => {
0 commit comments