-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
Version
4.1.3
Reproduction link
Steps to reproduce
Checkout code
git clone https://github.com/SimonPreini/VueRouterTesting
install dependencies
npm install
run tests
npm run test
What is expected?
Tests should finish successfully.
What is actually happening?
The router does not get mocked and is undefined -> test fails
[Vue warn]: injection "Symbol(router)" not found. at <ComponentToTest ref="VTU_COMPONENT" > at <VTUROOT>
[Vue warn]: Unhandled error during execution of native event handler at <ComponentToTest ref="VTU_COMPONENT" > at <VTUROOT> Error: Uncaught [TypeError: Cannot read properties of undefined (reading 'push')]
I created a mock for the router to check if it gets called. When I run the test it seems like the router is undefined and .push can not be executed which leads the test to fail.
When installing vue-router with version 4.0.x it works as expected.
Versions:
vue: 3.2.37
vue-router: 4.1.0
vitest: 0.19.1