describe('Lazy Loading', () => {
mockWarn()
+ let consoleErrorSpy: jest.SpyInstance
+ beforeEach(() => {
+ consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {})
+ })
+
+ afterEach(() => {
+ consoleErrorSpy.mockRestore()
+ })
+
it('works', async () => {
const { component, resolve } = createLazyComponent()
const { router } = newRouter({
const spy = jest.fn()
- reject(new Error('fail'))
+ const error = new Error('fail')
+ reject(error)
await router.push('/foo').catch(spy)
expect(spy).toHaveBeenCalled()
- expect('fail').toHaveBeenWarned()
+ expect(console.error).toHaveBeenCalledWith(error)
expect(router.currentRoute.value).toMatchObject({
path: '/',