Skip to content

Karma tests not running #251

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

Closed
melo0187 opened this issue Jun 3, 2014 · 33 comments
Closed

Karma tests not running #251

melo0187 opened this issue Jun 3, 2014 · 33 comments
Labels

Comments

@melo0187
Copy link

melo0187 commented Jun 3, 2014

From what I understand angular-fullstack generates both server tests for mocha and client tests for karma. For a newly generated app - after fixing both Gruntfile.js (see #247) and karma.conf.js (see #248) - I get following error when running grunt test :

[...]
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.10 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Linux)]: Connected on socket uyLE9920uagXDkUA7XIC
PhantomJS 1.9.7 (Linux): Executed 0 of 0 ERROR (0.149 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.
[...]

It's strange to read Executed 0 of 0 since from what I understand there is a unit test. Does this mean that karma is failing to prepare test execution? How can I further investigate?

Thanks in advance!

@deebloo
Copy link

deebloo commented Jun 3, 2014

I am having the same problem. Even after fixing the couple issues in the latest update with the incorrect file path and syntax error I am getting the same issue.

@JaKXz JaKXz added the bug label Jun 3, 2014
@deebloo
Copy link

deebloo commented Jun 3, 2014

I think i may have found the solution. if I include the following in the karma config file the tests are running correctly.

files: [
      '../app/bower_components/angular/angular.js',
      '../app/bower_components/angular-mocks/angular-mocks.js',
      '../app/bower_components/angular-resource/angular-resource.js',
      '../app/bower_components/angular-cookies/angular-cookies.js',
      '../app/bower_components/angular-sanitize/angular-sanitize.js',
      '../app/bower_components/angular-route/angular-route.js',
      '../app/scripts/*.js',
      '../app/scripts/**/*.js',
      'client/spec/**/*.js'
]

@melo0187
Copy link
Author

melo0187 commented Jun 3, 2014

I can confirm @DannyBlueDesign's solution. I copy-pasted the paths to the files array in the karma config and the test for MainCtrl runs (and fails for me, because I altered MainCtrl without adapting it's test...).

I did not test whether or not all paths are required and can not tell if this is the right way to solve the problem or not, since I'm new to karma (and test's in web development in general).

But for now it does the trick for me and I can start fixing my test, so thanks @DannyBlueDesign!

@deebloo
Copy link

deebloo commented Jun 3, 2014

TEST ALL THE THINGS!!!!!

@JaKXz
Copy link
Collaborator

JaKXz commented Jun 4, 2014

It's odd that snippet wasn't already there, my project built with an older version of the had it. @melo0187 I'm guessing you're using v.1.4.3?

@melo0187
Copy link
Author

melo0187 commented Jun 4, 2014

@JaKXz yes I am using v.1.4.3 of generator-angular-fullstack, installed globally with npm.

@deebloo
Copy link

deebloo commented Jun 4, 2014

That is how I found something to fix it. I looked through an older build I had done to compare.

@brandon-arnold
Copy link

I'm having the same problem, and unless I'm missing something, the above solution by DannyBlueDesign doesn't fix it. Can someone point in the right direction? It happens on both Fedora and Windows. Even the verbose output doesn't make sense, because the karma.conf.js file lists a number of files, and they all exist in the project directories.

Here's the verbose output in Windows. The punchline is that everything seems to go fine, but it says File: [no files] on the karma init, followed by "Executed 0 of 0 ERROR":

C:\Users\arnoldb\src\node\bacom>grunt karma:unit --verbose
Initializing
Command-line options: --verbose

Reading "Gruntfile.js" Gruntfile...OK

Registering Gruntfile tasks.

Registering "grunt-shell-spawn" local Npm module tasks.
Reading C:\Users\arnoldb\src\node\bacom\node_modules\grunt-shell-spawn\package.j
son...OK
Parsing C:\Users\arnoldb\src\node\bacom\node_modules\grunt-shell-spawn\package.j
son...OK
Loading "shell.js" tasks...OK
+ shell
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ build, default, express-keepalive, serve, server, test, wait

Running tasks: karma:unit

Loading "grunt-karma

Registering "C:\Users\arnoldb\src\node\bacom\node_modules\grunt-karma\tasks" tas
ks.
Loading "grunt-karma.js" tasks...OK
+ karma
>> Plugin loaded.

Running "karma:unit" (karma) task
Verifying property karma.unit exists in config...OK
File: [no files]
Options: background=false
INFO [karma]: Karma v0.12.22 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Windows 7)]: Connected on socket z4Kqb_4Gf-D7TSMKL7uX wit
h id 48428311
PhantomJS 1.9.7 (Windows 7): Executed 0 of 0 ERROR (0.002 secs / 0 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.


Execution Time (2014-08-20 16:11:12 UTC)
loading tasks  757ms  ■■■■■■ 13%
karma:unit      5.2s  ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 87%
Total 6s

Following is my karma.conf.js in the project root:

// Karma configuration
// http://karma-runner.github.io/0.10/config/configuration-file.html

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

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'client/bower_components/jquery/dist/jquery.js',
      'client/bower_components/angular/angular.js',
      'client/bower_components/angular-mocks/angular-mocks.js',
      'client/bower_components/angular-resource/angular-resource.js',
      'client/bower_components/angular-cookies/angular-cookies.js',
      'client/bower_components/angular-sanitize/angular-sanitize.js',
      'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',
      'client/bower_components/angular-ui-router/release/angular-ui-router.js',
      'client/bower_components/lodash/dist/lodash.compat.js',
      'client/app/app.coffee',
      'client/app/**/*.coffee',
      'client/components/**/*.coffee',
      'client/app/**/*.html',
      'client/components/**/*.html'
    ],

    preprocessors: {
      '**/*.jade': 'ng-jade2js',
      '**/*.html': 'html2js',
      '**/*.coffee': 'coffee',
    },

    ngHtml2JsPreprocessor: {
      stripPrefix: 'client/'
    },

    ngJade2JsPreprocessor: {
      stripPrefix: 'client/'
    },

    // 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: ['PhantomJS'],


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

@kingcody
Copy link
Member

@brandon-arnold, excuse me for my ignorance(?) but I was wondering what version of the generator you were using?

@brandon-arnold
Copy link

Thanks, Cody: I've just updated, and the version is 2.0.10, after having updated.

-Brandon

@kingcody
Copy link
Member

@brandon-arnold are you still having the issue after updating to the new version?

@brandon-arnold
Copy link

@kingcody: Yep. any idea where I can find a more verbose debug output?

@kingcody
Copy link
Member

In karma.conf.js, change logLevel: config.LOG_INFO to logLevel: config.LOG_DEBUG. See if that gives you any more info.

@brandon-arnold
Copy link

@kingcody: Thanks for the tip! I did it, but after having run grunt again, I'm unfortunately still baffled. Does anything jump out as noteworthy in the below output?

Running "karma:unit" (karma) task
DEBUG [plugin]: Loading karma-* from /home/brandon/src/node/bacom/node_modules
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-coffee-preprocessor.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-html2js-preprocessor.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-jade-preprocessor.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-ng-html2js-preprocessor.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-ng-jade2js-preprocessor.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-ng-scenario.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-requirejs.
DEBUG [plugin]: Loading plugin /home/brandon/src/node/bacom/node_modules/karma-script-launcher.
INFO [karma]: Karma v0.12.19 server started at http://localhost:8080/
INFO [launcher]: Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-89193109
DEBUG [launcher]: /home/brandon/src/node/bacom/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /tmp/karma-89193109/capture.js
WARN [watcher]: Pattern "/home/brandon/src/node/bacom/client/components/**/*.coffee" does not match any file.
WARN [watcher]: Pattern "/home/brandon/src/node/bacom/client/components/**/*.html" does not match any file.
DEBUG [preprocessor.coffee]: Processing "/home/brandon/src/node/bacom/client/app/app.coffee".
DEBUG [preprocessor.coffee]: Processing "/home/brandon/src/node/bacom/client/app/app.coffee".
DEBUG [preprocessor.coffee]: Processing "/home/brandon/src/node/bacom/client/app/main/main.coffee".
DEBUG [preprocessor.coffee]: Processing "/home/brandon/src/node/bacom/client/app/main/main.controller.coffee".
DEBUG [preprocessor.coffee]: Processing "/home/brandon/src/node/bacom/client/app/main/main.controller.spec.coffee".
DEBUG [preprocessor.html2js]: Processing "/home/brandon/src/node/bacom/client/app/main/actionVid/avdefault.html".
DEBUG [preprocessor.html2js]: Processing "/home/brandon/src/node/bacom/client/app/main/actionVid/avios.html".
DEBUG [preprocessor.html2js]: Processing "/home/brandon/src/node/bacom/client/app/main/main.html".
DEBUG [watcher]: Resolved files:
    /home/brandon/src/node/bacom/node_modules/karma-jasmine/lib/jasmine.js
    /home/brandon/src/node/bacom/node_modules/karma-jasmine/lib/adapter.js
    /home/brandon/src/node/bacom/client/bower_components/jquery/dist/jquery.js
    /home/brandon/src/node/bacom/client/bower_components/angular/angular.js
    /home/brandon/src/node/bacom/client/bower_components/angular-mocks/angular-mocks.js
    /home/brandon/src/node/bacom/client/bower_components/angular-resource/angular-resource.js
    /home/brandon/src/node/bacom/client/bower_components/angular-cookies/angular-cookies.js
    /home/brandon/src/node/bacom/client/bower_components/angular-sanitize/angular-sanitize.js
    /home/brandon/src/node/bacom/client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js
    /home/brandon/src/node/bacom/client/bower_components/angular-ui-router/release/angular-ui-router.js
    /home/brandon/src/node/bacom/client/bower_components/lodash/dist/lodash.compat.js
    /home/brandon/src/node/bacom/client/app/app.js
    /home/brandon/src/node/bacom/client/app/main/main.controller.js
    /home/brandon/src/node/bacom/client/app/main/main.controller.spec.js
    /home/brandon/src/node/bacom/client/app/main/main.js
    /home/brandon/src/node/bacom/client/app/main/actionVid/avdefault.html.js
    /home/brandon/src/node/bacom/client/app/main/actionVid/avios.html.js
    /home/brandon/src/node/bacom/client/app/main/main.html.js
DEBUG [web-server]: serving: /home/brandon/src/node/bacom/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /home/brandon/src/node/bacom/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/olO2oT-2BvjJGZuxZoif
DEBUG [karma]: A browser has connected on socket olO2oT-2BvjJGZuxZoif
INFO [PhantomJS 1.9.7 (Linux)]: Connected on socket olO2oT-2BvjJGZuxZoif with id 89193109
DEBUG [launcher]: PhantomJS (id 89193109) captured in 1.198 secs
DEBUG [web-server]: serving: /home/brandon/src/node/bacom/node_modules/karma/static/context.html
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/node_modules/karma-jasmine/lib/jasmine.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/node_modules/karma-jasmine/lib/adapter.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-cookies/angular-cookies.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-sanitize/angular-sanitize.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/jquery/dist/jquery.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular/angular.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-mocks/angular-mocks.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-resource/angular-resource.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/angular-ui-router/release/angular-ui-router.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/bower_components/lodash/dist/lodash.compat.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/app.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/main.controller.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/main.controller.spec.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/main.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/actionVid/avdefault.html.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/actionVid/avios.html.js
DEBUG [web-server]: serving (cached): /home/brandon/src/node/bacom/client/app/main/main.html.js
PhantomJS 1.9.7 (Linux): Executed 0 of 0 ERROR (0.039 secs / 0 secs)
DEBUG [karma]: Run complete, exitting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Process PhantomJS exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-89193109
Warning: Task "karma:unit" failed. Use --force to continue.

Aborted due to warnings.

@kingcody
Copy link
Member

Honestly no, it would seem karma was not able to find(?) any test. Odd as theres no error. It did say that it served /home/brandon/src/node/bacom/client/app/main/main.controller.spec.js, which looks like your only spec.js file. I might be able to help more if I could see your project code. Do you have that somewhere publicly available?

@brandon-arnold
Copy link

@kingcody: That led me to the fix! I apparently didn't have a test defined in main.controller.spec.js, and the karma section needs at least one test.

Thanks much!

@matthewharwood
Copy link

@brandon-arnold thanks so much just had the same problem.

@utkarsharma
Copy link

Hi Guys, i have same issue, but my test file have a test unlike brandon-arnold, here is the output

grunt test --verbose

Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Registering "grunt-autoprefixer" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-autoprefixer/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-autoprefixer/package.json...OK
Loading "autoprefixer.js" tasks...OK
+ autoprefixer
Registering "grunt-cdnify" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-cdnify/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-cdnify/package.json...OK
Loading "cdnify.js" tasks...OK
+ cdnify
Registering "grunt-concurrent" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-concurrent/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-concurrent/package.json...OK
Loading "concurrent.js" tasks...OK
+ concurrent
Registering "grunt-connect" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-connect/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Registering "grunt-contrib-clean" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-clean/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-clean/package.json...OK
Loading "clean.js" tasks...OK
+ clean
Registering "grunt-contrib-compass" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-compass/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-compass/package.json...OK
Loading "compass.js" tasks...OK
+ compass
Registering "grunt-contrib-concat" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-concat/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-concat/package.json...OK
Loading "concat.js" tasks...OK
+ concat
Registering "grunt-contrib-connect" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-connect/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-connect/package.json...OK
Loading "connect.js" tasks...OK
+ connect
Registering "grunt-contrib-copy" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-copy/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-copy/package.json...OK
Loading "copy.js" tasks...OK
+ copy
Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-cssmin/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-cssmin/package.json...OK
Loading "cssmin.js" tasks...OK
+ cssmin
Registering "grunt-contrib-htmlmin" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-htmlmin/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-htmlmin/package.json...OK
Loading "htmlmin.js" tasks...OK
+ htmlmin
Registering "grunt-contrib-imagemin" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-imagemin/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-imagemin/package.json...OK
Loading "imagemin.js" tasks...OK
+ imagemin
Registering "grunt-contrib-jshint" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-jshint/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-jshint/package.json...OK
Loading "jshint.js" tasks...OK
+ jshint
Registering "grunt-contrib-uglify" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-uglify/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-uglify/package.json...OK
Loading "uglify.js" tasks...OK
+ uglify
Registering "grunt-contrib-watch" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-watch/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Registering "grunt-filerev" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-filerev/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-filerev/package.json...OK
Loading "filerev.js" tasks...OK
+ filerev
Registering "grunt-google-cdn" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-google-cdn/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-google-cdn/package.json...OK
Loading "cdnify.js" tasks...OK
+ cdnify
Registering "grunt-karma" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-karma/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-karma/package.json...OK
Loading "grunt-karma.js" tasks...OK
+ karma
Registering "grunt-newer" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-newer/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-newer/package.json...OK
Loading "newer.js" tasks...OK
+ any-newer, newer, newer-clean, newer-postrun
Registering "grunt-ng-annotate" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-ng-annotate/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-ng-annotate/package.json...OK
Loading "ng-annotate.js" tasks...OK
+ ngAnnotate
Registering "grunt-svgmin" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-svgmin/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-svgmin/package.json...OK
Loading "svgmin.js" tasks...OK
+ svgmin
Registering "grunt-usemin" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-usemin/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-usemin/package.json...OK
Loading "usemin.js" tasks...OK
+ usemin, useminPrepare
Registering "grunt-wiredep" local Npm module tasks.
Reading /home/utkarsh/angular_dev/test/node_modules/grunt-wiredep/package.json...OK
Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-wiredep/package.json...OK
Loading "wiredep.js" tasks...OK
+ wiredep
Initializing config...OK
Loading "Gruntfile.js" tasks...OK
+ build, default, serve, server, test
Running tasks: test
Running "test" task
Running "clean:server" (clean) task
Verifying property clean.server exists in config...OK
Files: .tmp -> server
Options: force=false, no-write=false
Options: force=false, no-write=false
Cleaning .tmp...OK
Running "concurrent:test" (concurrent) task
Verifying property concurrent.test exists in config...OK
Files: [no src] -> test
Options: limit=4
    
    Initializing
    Command-line options: --verbose
    
    Reading "Gruntfile.js" Gruntfile...OK
    
    Registering Gruntfile tasks.
    
    Registering "grunt-autoprefixer" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-autoprefixer/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-autoprefixer/package.json...OK
    Loading "autoprefixer.js" tasks...OK
    + autoprefixer
    
    Registering "grunt-cdnify" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-cdnify/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-cdnify/package.json...OK
    Loading "cdnify.js" tasks...OK
    + cdnify
    
    Registering "grunt-concurrent" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-concurrent/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-concurrent/package.json...OK
    Loading "concurrent.js" tasks...OK
    + concurrent
    
    Registering "grunt-connect" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-connect/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-connect/package.json...OK
    Loading "connect.js" tasks...OK
    + connect
    
    Registering "grunt-contrib-clean" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-clean/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-clean/package.json...OK
    Loading "clean.js" tasks...OK
    + clean
    
    Registering "grunt-contrib-compass" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-compass/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-compass/package.json...OK
    Loading "compass.js" tasks...OK
    + compass
    
    Registering "grunt-contrib-concat" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-concat/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-concat/package.json...OK
    Loading "concat.js" tasks...OK
    + concat
    
    Registering "grunt-contrib-connect" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-connect/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-connect/package.json...OK
    Loading "connect.js" tasks...OK
    + connect
    
    Registering "grunt-contrib-copy" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-copy/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-copy/package.json...OK
    Loading "copy.js" tasks...OK
    + copy
    
    Registering "grunt-contrib-cssmin" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-cssmin/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-cssmin/package.json...OK
    Loading "cssmin.js" tasks...OK
    + cssmin
    
    Registering "grunt-contrib-htmlmin" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-htmlmin/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-htmlmin/package.json...OK
    Loading "htmlmin.js" tasks...OK
    + htmlmin
    
    Registering "grunt-contrib-imagemin" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-imagemin/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-imagemin/package.json...OK
    Loading "imagemin.js" tasks...OK
    + imagemin
    
    Registering "grunt-contrib-jshint" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-jshint/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-jshint/package.json...OK
    Loading "jshint.js" tasks...OK
    + jshint
    
    Registering "grunt-contrib-uglify" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-uglify/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-uglify/package.json...OK
    Loading "uglify.js" tasks...OK
    + uglify
    
    Registering "grunt-contrib-watch" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-watch/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-contrib-watch/package.json...OK
    Loading "watch.js" tasks...OK
    + watch
    
    Registering "grunt-filerev" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-filerev/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-filerev/package.json...OK
    Loading "filerev.js" tasks...OK
    + filerev
    
    Registering "grunt-google-cdn" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-google-cdn/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-google-cdn/package.json...OK
    Loading "cdnify.js" tasks...OK
    + cdnify
    
    Registering "grunt-karma" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-karma/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-karma/package.json...OK
    Loading "grunt-karma.js" tasks...OK
    + karma
    
    Registering "grunt-newer" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-newer/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-newer/package.json...OK
    Loading "newer.js" tasks...OK
    + any-newer, newer, newer-clean, newer-postrun
    
    Registering "grunt-ng-annotate" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-ng-annotate/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-ng-annotate/package.json...OK
    Loading "ng-annotate.js" tasks...OK
    + ngAnnotate
    
    Registering "grunt-svgmin" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-svgmin/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-svgmin/package.json...OK
    Loading "svgmin.js" tasks...OK
    + svgmin
    
    Registering "grunt-usemin" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-usemin/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-usemin/package.json...OK
    Loading "usemin.js" tasks...OK
    + usemin, useminPrepare
    
    Registering "grunt-wiredep" local Npm module tasks.
    Reading /home/utkarsh/angular_dev/test/node_modules/grunt-wiredep/package.json...OK
    Parsing /home/utkarsh/angular_dev/test/node_modules/grunt-wiredep/package.json...OK
    Loading "wiredep.js" tasks...OK
    + wiredep
    Initializing config...OK
    Loading "Gruntfile.js" tasks...OK
    + build, default, serve, server, test
    
    Running tasks: compass
    
    Running "compass" task
    
    Running "compass:dist" (compass) task
    Verifying property compass.dist exists in config...OK
    File: [no files]
    Options: sassDir="app/styles", cssDir=".tmp/styles", generatedImagesDir="dist/images/generated", imagesDir="app/images", javascriptsDir="app/scripts", fontsDir="app/styles/fonts", importPath="./bower_components", httpImagesPath="/images", httpGeneratedImagesPath="/images/generated", httpFontsPath="/styles/fonts", relativeAssets=false, assetCacheBuster=false, raw="Sass::Script::Number.precision = 10\n"
    directory .tmp/styles
        write .tmp/styles/main.css (1.119s)
    
    Running "compass:server" (compass) task
    Verifying property compass.server exists in config...OK
    File: [no files]
    Options: sassDir="app/styles", cssDir=".tmp/styles", generatedImagesDir=".tmp/images/generated", imagesDir="app/images", javascriptsDir="app/scripts", fontsDir="app/styles/fonts", importPath="./bower_components", httpImagesPath="/images", httpGeneratedImagesPath="/images/generated", httpFontsPath="/styles/fonts", relativeAssets=false, assetCacheBuster=false, raw="Sass::Script::Number.precision = 10\n", debugInfo
    
    Done, without errors.
    
    
    Execution Time (2014-11-23 18:26:46 UTC)
    loading tasks     4ms  0%
    compass:dist     1.4s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 77%
    compass:server  414ms  ▇▇▇▇▇▇▇▇▇▇▇ 23%
    Total 1.8s
    
Running "autoprefixer" task
Running "autoprefixer:dist" (autoprefixer) task
Verifying property autoprefixer.dist exists in config...OK
Files: .tmp/styles/main.css -> .tmp/styles/main.css
Options: cascade, diff=false, map=false, silent=false, remove, browsers=["last 1 version"]
Reading .tmp/styles/main.css...OK
Writing .tmp/styles/main.css...OK
File .tmp/styles/main.css created.
Running "connect:test" (connect) task
Verifying property connect.test exists in config...OK
File: [no files]
Options: protocol="http", port=9001, hostname="localhost", base=".", directory=null, keepalive=false, debug=false, livereload=35729, open=false, useAvailablePort=false, onCreateServer=null, middleware=undefined
Started connect web server on http://localhost:9001
Running "karma" task
Running "karma:unit" (karma) task
Verifying property karma.unit exists in config...OK
File: [no files]
Options: background=false
DEBUG [config]: autoWatch set to false, because of singleRun
DEBUG [plugin]: Loading karma-* from /home/utkarsh/angular_dev/test/node_modules
DEBUG [plugin]: Loading plugin /home/utkarsh/angular_dev/test/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /home/utkarsh/angular_dev/test/node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin /home/utkarsh/angular_dev/test/node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin /home/utkarsh/angular_dev/test/node_modules/karma-phantomjs-launcher.
DEBUG [plugin]: Loading plugin /home/utkarsh/angular_dev/test/node_modules/karma-requirejs.
INFO [karma]: Karma v0.12.25 server started at http://localhost:9876/
INFO [launcher]: Starting browser Firefox
DEBUG [temp-dir]: Creating temp dir at /tmp/karma-45070576
DEBUG [launcher]: firefox http://localhost:9876/?id=45070576 -profile /tmp/karma-45070576 -no-remote
DEBUG [watcher]: Resolved files:
    /home/utkarsh/angular_dev/test/node_modules/requirejs/require.js
    /home/utkarsh/angular_dev/test/node_modules/karma-requirejs/lib/adapter.js
    /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/jasmine.js
    /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/boot.js
    /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/adapter.js
    /home/utkarsh/angular_dev/test/test/spec/controllers/main.js
DEBUG [web-server]: serving: /home/utkarsh/angular_dev/test/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /home/utkarsh/angular_dev/test/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/TbSwGguo7AHttXkI5_qY
DEBUG [karma]: A browser has connected on socket TbSwGguo7AHttXkI5_qY
INFO [Firefox 33.0.0 (Ubuntu)]: Connected on socket TbSwGguo7AHttXkI5_qY with id 45070576
DEBUG [launcher]: Firefox (id 45070576) captured in 1.789 secs
DEBUG [web-server]: serving: /home/utkarsh/angular_dev/test/node_modules/karma/static/context.html
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/node_modules/requirejs/require.js
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/test/spec/controllers/main.js
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/node_modules/karma-requirejs/lib/adapter.js
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/jasmine.js
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/boot.js
DEBUG [web-server]: serving (cached): /home/utkarsh/angular_dev/test/node_modules/karma-jasmine/lib/adapter.js
WARN [Firefox 33.0.0 (Ubuntu)]: Disconnected (1 times), because no message in 10000 ms.
DEBUG [karma]: Run complete, exiting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [launcher]: Process Firefox exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /tmp/karma-45070576
Warning: Task "karma:unit" failed. Use --force to continue.
Aborted due to warnings.
Execution Time (2014-11-23 18:26:43 UTC)
loading tasks        3ms  0%
clean:server         5ms  0%
concurrent:test     4.3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 26%
autoprefixer:dist  112ms  ▇▇ 1%
connect:test        22ms  0%
karma:unit         11.9s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 73%
Total 16.3s

@minmur
Copy link

minmur commented Jan 18, 2015

I also had similar issue, but found out that newly installed bower_components were not loaded. Don't know if generator is meant to add them to karma.conf.js automatically, but i added manually and it works now.

@MillerRen
Copy link

please remove angular-scenario.js.

@ben-ids
Copy link

ben-ids commented Apr 20, 2015

@minmur I had a similar problem - missing includes in karma.conf as bower didn't add them automatically. Your comment saved me some trouble, thank you.

@mikecfisher
Copy link

Wow @MillerRen thanks so much for this. I was banging my head against the wall debugging karma (I inherited an old repo) and leaving angular-scenario in my bower.json was breaking my tests.

@Shawful
Copy link

Shawful commented Jun 3, 2015

I was able to fix this error by adding the following to my karma.conf.js file:

// list of files / patterns to exclude
exclude: [
  "**/*.git",
  "**/angular-scenario.js"
],

The trick was to exclude angular-scenario.js, but I'm not sure why. If anyone knows, please share.

Cheers!

@Shawful
Copy link

Shawful commented Jun 3, 2015

I mean, I know angular-mocks is for unit tests and angular-scenario is for end to end tests... so maybe a conf.js file cannot contain both without this error occurring.... Either way the error message needs to be improved.

@mikecfisher
Copy link

@Shawful Angular scenario runner is deprecated. You want to be using Protractor

@Shawful
Copy link

Shawful commented Jun 3, 2015

I don't understand. How exactly would I go about making the switch?

@Shawful
Copy link

Shawful commented Jun 3, 2015

Okay, so I found some docs (linked below). I imagine I would download the grunt-protractor runner using NPM (node package manager) from the command line, add the protractor task to my "grunt test" task list, and set it up to call it's own protractor config file and test files. Does that sound right?

Grunt Protractor Runner - NPM
https://www.npmjs.com/package/grunt-protractor-runner

Getting Started with Protractor
https://angular.github.io/protractor/#/

@Shawful
Copy link

Shawful commented Jun 3, 2015

oh and I would need to remove any references to angular-scenario.js from my original karma.conf.js file too.

@Shawful
Copy link

Shawful commented Jun 16, 2015

My team is working on AngularJS version 1.2.28 and hasn't made the move to 1.3.x yet. How do I find out if protractor works with 1.2.28?

@henrichsson
Copy link

I have a persisten problem:

Running "karma:unit" (karma) task
WARN [karma]: Port 8080 in use
INFO [karma]: Karma v0.12.37 server started at http://localhost:8081/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: Connected on socket Av5C7bRBz2eyogyWTzrp with id 17632309
Warning: Task "karma:unit" failed.� Use --force to continue.

Aborted due to warnings.

I do not understand what is wrong here??

@VivekWisdom
Copy link

Still no solution, I have gone through all the suggestions above.. Chrome browser is opening and immediately closing..

Running "wiredep:test" (wiredep) task

Running "karma:unit" (karma) task
16 02 2016 07:06:19.221:INFO [karma]: Karma v0.13.20 server started at http://localhost:8080/
16 02 2016 07:06:19.236:INFO [launcher]: Starting browser Chrome
16 02 2016 07:06:22.416:INFO [Chrome 48.0.2564 (Linux 0.0.0)]: Connected on socket /#QsrP_HYzeu4Pjk6LAAAC with id 67562059
Warning: Task "karma:unit" failed. Used --force, continuing.

Done, but with warnings.

Really appreciate any help.

@zyxue
Copy link

zyxue commented Jan 5, 2017

Still no fix?

@ghost
Copy link

ghost commented Jun 20, 2017

Doesn't run from command-line when autoWatch: false is set. Turned on singleRun: true, autoWatch: false. or autoWatch: true (<- still annoying) singleRun: false;

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

No branches or pull requests