Description
Version
1.0.0-beta.15
Reproduction link
https://github.com/doppelreim/test-router-in-child
Steps to reproduce
Run npm test
.
The component-under-test (HelloWorld.vue) uses this.$route.query
.
The child-component (ChildComp.vue) of the component-under-test uses this.$route.query
as well.
In the test, I inject a router-mock into the localvue.
When using shallow
, then it does not explode.
When using mount
, then it explodes with TypeError: Cannot read property 'query' of undefined
.
In the real app (not this minimal repro-repo), I want to use mount
, because I want to assert on the markup generated by bootstrap-vue
.
But there is also a different child-component that uses the router's query-params.
My best guess is, that the injected routerMock is visible only in the component under test, and it is somehow not visible in the child-component?
What is expected?
The test should not explode.
What is actually happening?
It explodes.