-
Notifications
You must be signed in to change notification settings - Fork 664
Closed
Description
Version
1.0.0-beta.13
Reproduction link
https://jsfiddle.net/getk99n0/
Steps to reproduce
- Follow the tutorial (https://vue-test-utils.vuejs.org/en/guides/using-with-vue-router.html) to mock the $route
import { shallow } from '@vue/test-utils'
describe('test', () => {
it('mock $route', () => {
const $route = { path: '/some/path' }
const wrapper = shallow(Sidebar, { mocks: { $route } }).vm
console.log(wrapper.$route)
})
})
- run the test and got undefined
What is expected?
Should get correct mock $route/$router value
What is actually happening?
Get undefined from wrapper.$route and wrapper.$router
I can still get { path: '/some/path' } as result when the version of the vue-router still in v2.7.0, sorry not sure if I should raise the issue here or in vue-router, can anyone help please :(? thanks!
NOTE that I also get this error '[vue-test-utils]: could not overwrite property $route, this usually caused by a plugin that has added the property as a read-only value'
but I didn't use any VueRouter in my other test case includes current one.
Metadata
Metadata
Assignees
Labels
No labels