angularjs 加载模块 "should have a dummy test"

angularjs loadModules "should have a dummy test"

运行 我项目的业力单元测试产量:

Browser (OS) XYZ section should have a dummy test for XYZ FAILED
    minErr/<@../angular.js:63:12
    loadModules/<@../angular.js:4141:15
    forEach@../angular.js:323:11
    loadModules@../angular.js:4099:5
    createInjector@../angular.js:4025:11
    workFn@../../vendor/angular-mocks/angular-mocks.js:2339:44

XYZ.spec:

describe('XYZ section', function () {
  beforeEach(module('blah.XYZ'));
  it('should have a dummy test for XYZ', inject(function() {
    expect(true).toBeTruthy();
  }));
});

我注意到有些状态找不到,但有些状态可以...

angular.js 的输出(即使没有缩小)也无法调试... 因此 angular.js 必须进行更改才能获得部分不错的调试输出

angular.js

function loadModules(modulesToLoad) {
  [...];
  try {
    [...];
  } catch (e) {
    [...];
    console.log(e);//<<<<<-------- this is needed in order to have
                   //<<<<<-------- any idea as to what is going on
    throw $injectorMinErr([...]);
  }
  [...];
}

在这种情况下它产生了:

LOG: '[$injector:unpr] Unknown provider: $stateProvider http://errors.angularjs.org/1.3.15/$injector/unpr?p0=%24stateProvider
minErr/<@[... blah blah blah ...]

这导致我在两个不同的文件中找到 angular.module("blah.XYZ", [...]);...我曾假设 angular 会合并两者的依赖列表并维护单个模块引用,但是 angular将简单地读取它遇到的第一个依赖列表并忽略第二次尝试...