我开始为我庞大的 AngularJS 应用程序编写测试。我在应用程序的任何地方都使用了 Router.generate()。
我第一次得到这个Router is not defined
所以,我router.js
在我的karma.conf.js
files: [
'./web/vendor/angular/angular.js',
'./node_modules/angular-ui-router/release/angular-ui-router.js',
'./web/bundles/fosjsrouting/js/router.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./web/assets/js/**/*.js', // all project files
'./web/assets/js/app.js', // app where angular.module defined
'./web/assets/tests/**/*.js' // is where all tests placed
],
现在我结束了'The route "api_get_users" does not exist'
,据我了解,这是Karma 在加载文件时遇到api_get_users
的第一个调用。Router.generate
据我所知,错误来自路由捆绑包,而不是来自 Karma,因此它无法找到可用路由列表,我不太了解如何预加载这些路由。
请帮我找到出路。