@@ -87,10 +87,10 @@ describe('router.beforeEach', () => {
8787 const spy = vi . fn ( )
8888 const router = createRouter ( { routes } )
8989 await router . push ( '/foo' )
90- spy . mockImplementation ( ( to , from , next ) => {
90+ spy . mockImplementation ( ( to , from ) => {
9191 // only allow going to /other
92- if ( to . fullPath !== '/other' ) next ( '/other' )
93- else next ( )
92+ if ( to . fullPath !== '/other' ) return '/other'
93+ else return
9494 } )
9595 router . beforeEach ( spy )
9696 expect ( spy ) . not . toHaveBeenCalled ( )
@@ -160,11 +160,11 @@ describe('router.beforeEach', () => {
160160 const spy = vi . fn ( )
161161 const router = createRouter ( { routes } )
162162 await router . push ( '/' )
163- spy . mockImplementation ( ( to , from , next ) => {
163+ spy . mockImplementation ( ( to , from ) => {
164164 // only allow going to /other
165165 const i = Number ( to . params . i )
166- if ( i >= 3 ) next ( )
167- else next ( redirectFn ( String ( i + 1 ) ) )
166+ if ( i >= 3 ) return
167+ else return redirectFn ( String ( i + 1 ) )
168168 } )
169169 router . beforeEach ( spy )
170170 expect ( spy ) . not . toHaveBeenCalled ( )
@@ -210,9 +210,9 @@ describe('router.beforeEach', () => {
210210 it ( 'waits before navigating' , async ( ) => {
211211 const [ promise , resolve ] = fakePromise ( )
212212 const router = createRouter ( { routes } )
213- router . beforeEach ( async ( to , from , next ) => {
213+ router . beforeEach ( async ( to , from ) => {
214214 await promise
215- next ( )
215+ return
216216 } )
217217 const p = router . push ( '/foo' )
218218 expect ( router . currentRoute . value . fullPath ) . toBe ( '/' )
@@ -227,17 +227,17 @@ describe('router.beforeEach', () => {
227227 const router = createRouter ( { routes } )
228228 const guard1 = vi . fn ( )
229229 let order = 0
230- guard1 . mockImplementationOnce ( async ( to , from , next ) => {
230+ guard1 . mockImplementationOnce ( async ( to , from ) => {
231231 expect ( order ++ ) . toBe ( 0 )
232232 await p1
233- next ( )
233+ return
234234 } )
235235 router . beforeEach ( guard1 )
236236 const guard2 = vi . fn ( )
237- guard2 . mockImplementationOnce ( async ( to , from , next ) => {
237+ guard2 . mockImplementationOnce ( async ( to , from ) => {
238238 expect ( order ++ ) . toBe ( 1 )
239239 await p2
240- next ( )
240+ return
241241 } )
242242 router . beforeEach ( guard2 )
243243 let navigation = router . push ( '/foo' )
0 commit comments