File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,15 @@ function createLazyComponent() {
26
26
27
27
describe ( 'Lazy Loading' , ( ) => {
28
28
mockWarn ( )
29
+ let consoleErrorSpy : jest . SpyInstance
30
+ beforeEach ( ( ) => {
31
+ consoleErrorSpy = jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
32
+ } )
33
+
34
+ afterEach ( ( ) => {
35
+ consoleErrorSpy . mockRestore ( )
36
+ } )
37
+
29
38
it ( 'works' , async ( ) => {
30
39
const { component, resolve } = createLazyComponent ( )
31
40
const { router } = newRouter ( {
@@ -250,11 +259,12 @@ describe('Lazy Loading', () => {
250
259
251
260
const spy = jest . fn ( )
252
261
253
- reject ( new Error ( 'fail' ) )
262
+ const error = new Error ( 'fail' )
263
+ reject ( error )
254
264
await router . push ( '/foo' ) . catch ( spy )
255
265
256
266
expect ( spy ) . toHaveBeenCalled ( )
257
- expect ( 'fail' ) . toHaveBeenWarned ( )
267
+ expect ( console . error ) . toHaveBeenCalledWith ( error )
258
268
259
269
expect ( router . currentRoute . value ) . toMatchObject ( {
260
270
path : '/' ,
You can’t perform that action at this time.
0 commit comments