karma-runner / karma-coverage

A Karma plugin. Generate code coverage.
MIT License
768 stars 247 forks source link

Coverage on v0.12 #69

Open zazoomauro opened 10 years ago

zazoomauro commented 10 years ago

I can't see my xml coverage anymore with Karma 0.12. Was working with old Kama versions.

This is my configuration:

module.exports = {
  port: 9876,
  captureTimeout: 60000,
  frameworks: ['jasmine'],
  basePath: 'app/build',
  singleRun: true,
  browsers: [
    'Chrome',
    'Firefox'
  ],
  plugins: [
    'karma-jasmine',
    'karma-coverage',
    'karma-story-reporter',
    'karma-phantomjs-launcher',
    'karma-firefox-launcher',
    'karma-chrome-launcher'
  ],
  files: [
    'all my files'
  ],
  exclude: [
    '**/*.scenario.js'
  ],
  reporters: ['coverage', 'dots'],
  preprocessors: {
    '!(bower_components)/**/!(*.spec).js': 'coverage'
  },
  coverageReporter:  {
    type : 'cobertura',
    dir : '../coverage',
    file: 'coverage.xml'
  }
};
vojtajina commented 10 years ago

Are you getting any error? Is the coverage file empty or not created at all? Can you post the output of karma ... --log-level debug?

bbialas commented 10 years ago

Hi, same problem here. Code coverage folder is created with this content: CodeCoverageFolder     PhantomJS 1.9.7 (Mac OS X)         index.html         prettify.css         prettify.js No xml file with results...

Debug output is without errors... (only one error related to that I don't have any tests yet)

Running "karma:modules" (karma) task
DEBUG [config]: No config file specified.
DEBUG [plugin]: Loading karma-* from /Users/Ril/Work/xxx/node_modules
DEBUG [plugin]: Loading plugin /Users/Ril/Work/xxx/node_modules/karma-chai.
DEBUG [plugin]: Loading plugin /Users/Ril/Work/xxx/node_modules/karma-chai-sinon.
DEBUG [plugin]: Loading plugin /Users/Ril/Work/xxx/node_modules/karma-coverage.
DEBUG [plugin]: Loading plugin /Users/Ril/Work/xxx/node_modules/karma-mocha.
DEBUG [plugin]: Loading plugin /Users/Ril/Work/xxx/node_modules/karma-phantomjs-launcher.
INFO [karma]: Karma v0.12.0 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
DEBUG [temp-dir]: Creating temp dir at /var/folders/9s/b9ckf62n7hz5fj8b3ytkbk400000gp/T/karma-9028860
DEBUG [launcher]: /Users/Ril/Work/xxx/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs /var/folders/9s/b9ckf62n7hz5fj8b3ytkbk400000gp/T/karma-9028860/capture.js
WARN [watcher]: Pattern "/Users/Ril/Work/xxx/tests/*.html" does not match any file.
WARN [watcher]: Pattern "/Users/Ril/Work/xxx/tests/**/*Spec.js" does not match any file.
DEBUG [preprocessor.coverage]: Processing "/Users/Ril/Work/xxx/currencyChange.js".
DEBUG [preprocessor.coverage]: Processing "/Users/Ril/Work/xxx/survey.js".
DEBUG [watcher]: Resolved files:
    /Users/Ril/Work/xxx/node_modules/sinon/pkg/sinon.js
    /Users/Ril/Work/xxx/node_modules/chai/chai.js
    /Users/Ril/Work/xxx/node_modules/sinon-chai/lib/sinon-chai.js
    /Users/Ril/Work/xxx/node_modules/karma-chai-sinon/adapter.js
    /Users/Ril/Work/xxx/node_modules/karma-chai/adapter.js
    /Users/Ril/Work/xxx/node_modules/mocha/mocha.js
    /Users/Ril/Work/xxx/node_modules/karma-mocha/lib/adapter.js
DEBUG [web-server]: serving: /Users/Ril/Work/xxx/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /Users/Ril/Work/xxx/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/DE8MIK7JzobfRBICadFs
DEBUG [karma]: A browser has connected on socket DE8MIK7JzobfRBICadFs
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket DE8MIK7JzobfRBICadFs with id 9028860
DEBUG [launcher]: PhantomJS (id 9028860) captured in 1.607 secs
DEBUG [web-server]: serving: /Users/Ril/Work/xxx/node_modules/karma/static/context.html
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/sinon/pkg/sinon.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/chai/chai.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/sinon-chai/lib/sinon-chai.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/karma-chai/adapter.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/karma-chai-sinon/adapter.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/mocha/mocha.js
DEBUG [web-server]: serving (cached): /Users/Ril/Work/xxx/node_modules/karma-mocha/lib/adapter.js
PhantomJS 1.9.7 (Mac OS X): Executed 0 of 0 ERROR (0.004 secs / 0 secs)
DEBUG [karma]: Run complete, exitting.
DEBUG [launcher]: Disconnecting all browsers
DEBUG [coverage]: Writing coverage to /Users/Ril/Work/xxx/jsCodeCoverage/PhantomJS 1.9.7 (Mac OS X)
DEBUG [launcher]: Process PhantomJS exited with code 0
DEBUG [temp-dir]: Cleaning temp dir /var/folders/9s/b9ckf62n7hz5fj8b3ytkbk400000gp/T/karma-9028860
Warning: Task "karma:modules" failed. Use --force to continue.

Aborted due to warnings.
bilalq commented 10 years ago

Any update on this? #70 seems to be related as well.

bbialas commented 10 years ago

Hi, I updated dependecies and now everything (code coverage) work. Try to use latest versions, and this should help :) If you want, I can put here my current versions ;)

bilalq commented 10 years ago

Ah, that's good to hear. A list of versions would indeed be helpful, I think. If it seems to be working, then I suppose these two issues can be safely closed.

bbialas commented 10 years ago

Right now I am using:

{
  "name": "xxx",
  "preferGlobal": false,
  "version": "0.0.1",
  "author": "Bartosz Bialas",
  "description": "xxx Front-end tools",
  "devDependencies": {
    "grunt": "~0.4.4",
    "grunt-contrib-jshint": "~0.10.0",
    "grunt-karma": "~0.8.2",
    "karma-mocha": "~0.1.3",
    "karma-chai": "~0.1.0",
    "karma-chai-sinon": "~0.1.3",
    "karma-coverage": "~0.2.1",
    "karma": "~0.12.9",
    "karma-phantomjs-launcher": "*",
    "karma-html2js-preprocessor": "*",
    "phantomjs": "~1.9.7-3",
    "karma-chrome-launcher": "~0.1.3"
  },
  "engines": {
    "node": "~0.10"
  }
}

And I think, that this ticket can be closed.

spenoir commented 10 years ago

If I use Karma version ~0.12 (or latest) I run into this old issue when using the junit reporter: https://github.com/karma-runner/karma-coverage/issues/30

heres my dependencies:

"dependencies": {
    "karma-chrome-launcher": "~0.1.0",
    "karma-firefox-launcher": "~0.1.0",
    "karma-html2js-preprocessor": "~0.1.0",
    "karma-jasmine": "latest",
    "karma-coverage": "0.1.2",
    "karma-phantomjs-launcher": "~0.1.0",
    "karma-junit-reporter": "~0.1",
    "karma-script-launcher": "~0.1.0",
    "karma-osx-reporter": "latest",
    "karma-browserstack-launcher": "latest",
    "protractor": "latest",
    "karma": "~0.12.9",
    "bower": "latest",
    "bower-installer": "latest",
    "yo": "latest",
    "grunt": "latest",
    "chalk": "latest",
    "grunt-contrib-sass": "latest",
    "grunt-contrib-watch": "latest",
    "grunt-contrib-compass": "latest",
    "karma-teamcity-reporter": "latest"
},

I'm now using Karma version ~0.10 with karma-coverage 0.1.2 which works fine and generates a junit report.