Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Karma config does not support angular-route #25

Open
ElliotPsyIT opened this issue Apr 10, 2015 · 0 comments
Open

Karma config does not support angular-route #25

ElliotPsyIT opened this issue Apr 10, 2015 · 0 comments

Comments

@ElliotPsyIT
Copy link

The default karma.conf.js list of files only includes angular-ui-router.js by default. But if during yo scaffolding you choose ngRoute you run into two grunt test problems.

A warning that angular-route.js isn't installed:

WARN [watcher]: Pattern "/Users/me/Angular/angular-ng-appgen/bower_components/angular-ui-router/release/angular-ui-router.js" 
does not match any file.

And, an an ugly set of errors indicating angular-route.js is not among karma.conf.js files (a part of one error):

homeService
    ✖ should return welcome message
      Chrome 41.0.2272 (Mac OS X 10.9.5)
    Error: [$injector:modulerr] Failed to instantiate module home due to:
    Error: [$injector:modulerr] Failed to instantiate module ngRoute due to:
    Error: [$injector:nomod] Module 'ngRoute' is not available! You either misspelled the module name or
 forgot to load it. If registering a module ensure that you specify the dependencies as the second 
argument.

One simple (though not elegant) solution would be to include in the generator's karma.conf.js a reference to angular-route.js along with the default angular-ui-router.js.

       files : [
            'bower_components/angular/angular.js',
            'bower_components/angular-mocks/angular-mocks.js',
            'bower_components/underscore/underscore.js',
            'bower_components/angular-ui-router/release/angular-ui-router.js', 
            ***'bower_components/angular-route/angular-route.js', ***
            'bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
            'bower_components/angular-ui-utils/ui-utils.js',
            'bower_components/angular-animate/angular-animate.js',
            'bower_components/restangular/dist/restangular.js',
            'app/*/*.js',
            'app/**/**/*.js',
            'test/specs/**/**/*-spec.js'
        ],

Then, testing produces only a benign file not found warning which ever router you choose. Seems like a reasonable trade off when compared with the time it would take to build karma.conf.js dynamically :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant