@@ -114,7 +114,7 @@ describe('console', () => {
114
114
} ) ;
115
115
116
116
it ( 'should not append multiple stacks' , ( ) => {
117
- const Child = ( ) => {
117
+ const Child = ( { children } ) => {
118
118
fakeConsole . warn ( 'warn\n in Child (at fake.js:123)' ) ;
119
119
fakeConsole . error ( 'error' , '\n in Child (at fake.js:123)' ) ;
120
120
return null ;
@@ -135,12 +135,12 @@ describe('console', () => {
135
135
136
136
it ( 'should append component stacks to errors and warnings logged during render' , ( ) => {
137
137
const Intermediate = ( { children} ) => children ;
138
- const Parent = ( ) => (
138
+ const Parent = ( { children } ) => (
139
139
< Intermediate >
140
140
< Child />
141
141
</ Intermediate >
142
142
) ;
143
- const Child = ( ) => {
143
+ const Child = ( { children } ) => {
144
144
fakeConsole . error ( 'error' ) ;
145
145
fakeConsole . log ( 'log' ) ;
146
146
fakeConsole . warn ( 'warn' ) ;
@@ -156,24 +156,24 @@ describe('console', () => {
156
156
expect ( mockWarn . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
157
157
expect ( mockWarn . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'warn' ) ;
158
158
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 0 ] [ 1 ] ) ) . toEqual (
159
- '\n in Child (at **)\n in Parent (at **)' ,
159
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
160
160
) ;
161
161
expect ( mockError ) . toHaveBeenCalledTimes ( 1 ) ;
162
162
expect ( mockError . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
163
163
expect ( mockError . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'error' ) ;
164
164
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 0 ] [ 1 ] ) ) . toBe (
165
- '\n in Child (at **)\n in Parent (at **)' ,
165
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
166
166
) ;
167
167
} ) ;
168
168
169
169
it ( 'should append component stacks to errors and warnings logged from effects' , ( ) => {
170
170
const Intermediate = ( { children} ) => children ;
171
- const Parent = ( ) => (
171
+ const Parent = ( { children } ) => (
172
172
< Intermediate >
173
173
< Child />
174
174
</ Intermediate >
175
175
) ;
176
- const Child = ( ) => {
176
+ const Child = ( { children } ) => {
177
177
React . useLayoutEffect ( ( ) => {
178
178
fakeConsole . error ( 'active error' ) ;
179
179
fakeConsole . log ( 'active log' ) ;
@@ -198,29 +198,29 @@ describe('console', () => {
198
198
expect ( mockWarn . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
199
199
expect ( mockWarn . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'active warn' ) ;
200
200
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 0 ] [ 1 ] ) ) . toEqual (
201
- '\n in Child (at **)\n in Parent (at **)' ,
201
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
202
202
) ;
203
203
expect ( mockWarn . mock . calls [ 1 ] ) . toHaveLength ( 2 ) ;
204
204
expect ( mockWarn . mock . calls [ 1 ] [ 0 ] ) . toBe ( 'passive warn' ) ;
205
205
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 1 ] [ 1 ] ) ) . toEqual (
206
- '\n in Child (at **)\n in Parent (at **)' ,
206
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
207
207
) ;
208
208
expect ( mockError ) . toHaveBeenCalledTimes ( 2 ) ;
209
209
expect ( mockError . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
210
210
expect ( mockError . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'active error' ) ;
211
211
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 0 ] [ 1 ] ) ) . toBe (
212
- '\n in Child (at **)\n in Parent (at **)' ,
212
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
213
213
) ;
214
214
expect ( mockError . mock . calls [ 1 ] ) . toHaveLength ( 2 ) ;
215
215
expect ( mockError . mock . calls [ 1 ] [ 0 ] ) . toBe ( 'passive error' ) ;
216
216
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 1 ] [ 1 ] ) ) . toBe (
217
- '\n in Child (at **)\n in Parent (at **)' ,
217
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
218
218
) ;
219
219
} ) ;
220
220
221
221
it ( 'should append component stacks to errors and warnings logged from commit hooks' , ( ) => {
222
222
const Intermediate = ( { children} ) => children ;
223
- const Parent = ( ) => (
223
+ const Parent = ( { children } ) => (
224
224
< Intermediate >
225
225
< Child />
226
226
</ Intermediate >
@@ -254,29 +254,29 @@ describe('console', () => {
254
254
expect ( mockWarn . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
255
255
expect ( mockWarn . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'didMount warn' ) ;
256
256
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 0 ] [ 1 ] ) ) . toEqual (
257
- '\n in Child (at **)\n in Parent (at **)' ,
257
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
258
258
) ;
259
259
expect ( mockWarn . mock . calls [ 1 ] ) . toHaveLength ( 2 ) ;
260
260
expect ( mockWarn . mock . calls [ 1 ] [ 0 ] ) . toBe ( 'didUpdate warn' ) ;
261
261
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 1 ] [ 1 ] ) ) . toEqual (
262
- '\n in Child (at **)\n in Parent (at **)' ,
262
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
263
263
) ;
264
264
expect ( mockError ) . toHaveBeenCalledTimes ( 2 ) ;
265
265
expect ( mockError . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
266
266
expect ( mockError . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'didMount error' ) ;
267
267
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 0 ] [ 1 ] ) ) . toBe (
268
- '\n in Child (at **)\n in Parent (at **)' ,
268
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
269
269
) ;
270
270
expect ( mockError . mock . calls [ 1 ] ) . toHaveLength ( 2 ) ;
271
271
expect ( mockError . mock . calls [ 1 ] [ 0 ] ) . toBe ( 'didUpdate error' ) ;
272
272
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 1 ] [ 1 ] ) ) . toBe (
273
- '\n in Child (at **)\n in Parent (at **)' ,
273
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
274
274
) ;
275
275
} ) ;
276
276
277
277
it ( 'should append component stacks to errors and warnings logged from gDSFP' , ( ) => {
278
278
const Intermediate = ( { children} ) => children ;
279
- const Parent = ( ) => (
279
+ const Parent = ( { children } ) => (
280
280
< Intermediate >
281
281
< Child />
282
282
</ Intermediate >
@@ -303,18 +303,18 @@ describe('console', () => {
303
303
expect ( mockWarn . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
304
304
expect ( mockWarn . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'warn' ) ;
305
305
expect ( normalizeCodeLocInfo ( mockWarn . mock . calls [ 0 ] [ 1 ] ) ) . toEqual (
306
- '\n in Child (at **)\n in Parent (at **)' ,
306
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
307
307
) ;
308
308
expect ( mockError ) . toHaveBeenCalledTimes ( 1 ) ;
309
309
expect ( mockError . mock . calls [ 0 ] ) . toHaveLength ( 2 ) ;
310
310
expect ( mockError . mock . calls [ 0 ] [ 0 ] ) . toBe ( 'error' ) ;
311
311
expect ( normalizeCodeLocInfo ( mockError . mock . calls [ 0 ] [ 1 ] ) ) . toBe (
312
- '\n in Child (at **)\n in Parent (at **)' ,
312
+ '\n in Child (at **)\n in Intermediate (at **)\n in Parent (at **)' ,
313
313
) ;
314
314
} ) ;
315
315
316
316
it ( 'should append stacks after being uninstalled and reinstalled' , ( ) => {
317
- const Child = ( ) => {
317
+ const Child = ( { children } ) => {
318
318
fakeConsole . warn ( 'warn' ) ;
319
319
fakeConsole . error ( 'error' ) ;
320
320
return null ;
0 commit comments