我想在我的 Vue 2 项目中测试 Vue Router 的“beforeRouteUpdate”和“beforeRouteLeave”导航守卫。
尽管有很多关于如何使用 Vue Test Utils 进行测试的答案,但我无法找到如何使用 Vue 测试库进行测试。在这些答案中(对于 Vue Test Utils),他们建议通过
获取该功能 "workbench.colorCustomizations": {
// "editorError.border": "#fff0",
// "editorError.foreground": "#fff0",
"editorWarning.border": "#fff0",
"editorWarning.foreground": "#fff0",
"editorWarning.background": "#fff0",
"errorLens.warningBackground": "#fff0",
"errorLens.warningForeground": "#fff0"
// ...
}
不幸的是,它似乎在 Vue 测试库中 the wrapper
is not exposed,所以我被卡住了。
那么……使用 Vue 测试库测试 Vue Router 的导航守卫的正确方法是什么?或者我应该为此使用 Vue Test Utils 吗?