0

我开始为我庞大的 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,因此它无法找到可用路由列表,我不太了解如何预加载这些路由。

请帮我找到出路。

4

1 回答 1

0

哦!到目前为止我找到了答案,希望这会有所帮助

只需生成教程中所示的路线,然后将fos_js_routes.js文件包含到 Karmafiles部分

于 2018-02-02T10:00:42.707 回答