evangalen / ng-improved-testing

Improves AngularJS testing
MIT License
21 stars 4 forks source link

Error on circular module dependencies. #1

Closed lammertw closed 10 years ago

lammertw commented 10 years ago

When testing a controller that's part of a module with a circular dependency the test throws an error.

angular.module('appFilters', ['appResources']);
angular.module('appResources', ['appFilters']);

var appModule = angular.module('myApp', [
    'appResources'
]);

appModule.controller('AppController', function($scope) {
});

I know that having a circular module dependency is bad and that's something I should fix on my side (I just discovered it because I was trying ng-improved-testing) but apparently angular allows it (as long as the services and controllers inside the modules don't depend on each other) so maybe that's something that ng-improved-testing could support as well.

Here is the error: PhantomJS 1.9.7 (Mac OS X) ngImprovedTesting mocked style AppController specification encountered a declaration exception FAILED

    at forEach (/Users/.../app/bower_components/angular/angular.js:304)
    at findInvokeQueueItemInfoRecursive (/Users/.../app/bower_components/ng-module-introspector/ng-module-introspector.js:321)
    at /Users/.../app/bower_components/ng-module-introspector/ng-module-introspector.js:312
evangalen commented 10 years ago

That's most definitely a bug, ngImprovedTesting shouldn't be opinionated about things like circular module dependencies. This Monday night I will look into it, most likely I will release a new version before Tuesday morning.