How do I fix my generator-angular project so that grunt test works?

All we need is an easy explanation of the problem, so here it is.

I am working off of this tutorial: as a means to understand what files are created using yo generator-angular.

I have experience using AngularJS, but was looking for a way to get a best-practices directory set up; I am not sure how to set up dependencies and get karma running on my own, hence using the yeoman generator.

However, straight out of the box, without editing anything else, when I run grunt test I get the following:

running "clean:server" (clean) task
Cleaning .tmp...OK

Running "concurrent:test" (concurrent) task

Running "copy:styles" (copy) task
Copied 1 files

Done, without errors

Running "autoprefixer:dist" (autoprefixer) task
Prefixed file ".tmp/styles/main.css" created.

Running "connect:test" (connect) task
Started connect web server on 127.0..0.1:9001.

Running "karma:unit" (karma) task
Warning: No provider for "framework:jasmine"! (resolving: framework:jasmine) Use --force to continue.

Aborted due to warnings.

I don’t understand why jasmine has no provider, and not sure how to go about resolving this issue. is it a matter of fixing my package.json files and updating node?

EDIT: Here is the config file:

// Karma configuration

module.exports = function(config) {
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)

    // list of files / patterns to load in the browser
    files: [

    // list of files / patterns to exclude
    exclude: [],

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: false,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false


How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

I seem to have fixed my problem, for anyone with a similar problem:

Within my karma.conf.js I added the following:

plugins: [

At first I added ‘karma-jasmine’ but was then met with “Can not load “Chrome”, it is not registered!” This was solved by adding ‘karma-chrome-launcher’ as a plug-in

Not sure if it was my fault or whether generator-angular is out of date, but it is now working.

Method 2

The github issue pointed out by @Jim Schubert has this comment:

The full list of karma dependencies that I needed to install to get
tests working (coffeescript).

npm install --save-dev karma-chrome-launcher karma-firefox-launcher karma-safari-launcher karma-opera-launcher karma-ie-launcher karma-jasmine karma-coffee-preprocessor

Method 3

If you used the --coffee flag on the yo angular command you’ll need to:

install some browser launcher (chrome in this case) and the following npm packages:

npm install --save-dev karma-chrome-launcher karma-jasmine karma-coffee-preprocessor

and add the following to your karma.conf.js file:

plugins:['karma-chrome-launcher', 'karma-jasmine', 'karma-coffee-preprocessor'],

After that running grunt test should work.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply