Closed BaskovicP closed 4 years ago
I did not realize this subtle bug (I hardly unit test my router, I think that is best done in an integration test using an e2e tool and a real browser).
None the less, this seems important info to include. Thanks for the PR. I can review it this weekend.
PS: does const router = new VueRouter({ routes, mode: 'history' })
work as well? I think history
is the most common mode people are using now days.
I agree with you on that one about using the e2e tools. Still much to learn here.
Also checked the 'history' mode now and it seems to work. So the only one that is not working is hash.
Would also be interesting to dig deeper as why. Thanks for the future review.
Great, I'll merge this up! Thanks for the contribution.
STEPS TO REPRODUCE You can check the code in the commit.
After some time of wondering why are my wrapper routes not correct it seems that the answer is the automatic hash mode which is activated for creating the vueRouter. (Has to do with the hash mode router getting the jest jsdom window.location and setting the router from this variable) As can be read on https://router.vuejs.org/api/#mode
POSSIBLE PROBLEMS: You may newer be shure on which path you are and if you go with the router on the same path it can produce an error.
Tested on simple vue-cli program.