Giter VIP home page Giter VIP logo

karma-coverage's People

Contributors

abierbaum avatar anthony-redfox avatar aymericbeaumet avatar dependabot[bot] avatar devoto13 avatar dignifiedquire avatar douglasduteil avatar hicom150 avatar htanjo avatar johnjbarton avatar kombucha avatar krinkle avatar maksimr avatar manevpe avatar mwinche avatar nicojs avatar nmalaguti avatar pr1sm avatar robinboehm avatar sahat avatar semantic-release-bot avatar timothykang avatar timvdlippe avatar tkrotoff avatar tmcgann avatar tswaters avatar unframework avatar vojtajina avatar weikinhuang avatar zzo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

karma-coverage's Issues

peerDependencies

Was thinking it might be useful to make istanbul and ibrik peerDependencies, kind of what karma-mocha does with mocha.

This could be a precursor to inject your own instrumentation method(s).

Though this issue is really just about being more in control of the versions of the dependencies.

If not this, at least could instanbul be updated to the latest?

lcov report built into a folder name that changes per environment

Coverage builds into a directory that includes the name of the browser and the OS. This makes it nondeterministic.

With these options:

coverageReporter: # https://github.com/karma-runner/karma-coverage
  reporters: [
    {
      type: 'text-summary'
    }
    {
      type: 'lcov'
    }
  ]
  dir: '../.tmp/coverage'

The coverage output goes to:

.tmp/coverage/PahtomJS 1.9.2 (Mac OS X)/lcov-report

If my dev environment is osx and my CI environment is Unix, the coverage report will be in a different place, making it difficult to automate around. (in my case I want to have the build system put it in a central location so the CI server has a coverage report in a fixed location every build)

Is the changing folder name intentional? Is there a way around this, either by locking down the folder name or by pulling the calculated name out of a variable and passing it to the build system?

Generate only one coverage report for all browsers

Currently when I'm running tests in multiple browsers it generates a folder for every browser and all of them contains "cobertura-coverage.xml".
Obviously they are all the same.

Isn't it better to generate only one report?
Or am I doing something wrong / misunderstanding the concept?

With a directory specified, files are being generated along with .js files

I'm using this config:

    coverageReporter: {
        type : 'html',
        dir : '../coverage/'
    },
    preprocessors: {
        '../../Ccee/js/way2.filtroDePontos.js': 'coverage',
        '../../Ccee/js/models/*.js': 'coverage',
        '../../Ccee/js/views/*.js': 'coverage',
        '../../Ccee/js/viewmodels/*.js': 'coverage'
    }

Since i have specified a directory for my coverage, then why files are being created along with my .js files?
image

This is pretty annoying. Shouldn't all this files be inside my /coverage folder?

onBrowserStart not triggered => Coverage files not written

OS: Mac OSX 10.9
Node: 0.10.20
Karma: 0.10.4
Karma-coverage: 0.1.1
Browser: tried Chrome and PhantomJS, same issue

CoverageReporter.onBrowserStart isn't triggered and therefore onBrowserComplete returns immediately (fails to find corresponding collector), without creating the coverage files.

Creating the collector on browser complete fixes the issue but might have some side effects?

Colors still output to text-summary file with colors:false set

I'm still seeing some escape characters when trying to output text-summary to a file with colors turned off...

module.exports = function(config) {
  config.set({
    basePath: '',
    autoWatch: true,
    frameworks: ['qunit'],
    files: [

    ],

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

    // test results reporter to use
    // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
    reporters: ['progress', 'coverage'],
    preprocessors: {
        'source/**/*.js': ['coverage']
    },

    plugins: [
      // these plugins will be require() by Karma
      'karma-coverage',
      'karma-qunit',
      'karma-phantomjs-launcher'
    ],

    colors: false,

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

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera (has to be installed with `npm install karma-opera-launcher`)
    // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
    // - PhantomJS
    // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
    browsers: ['PhantomJS'],

    singleRun: false,

    coverageReporter: {
      type : 'text',
      dir : 'coverage/',
      file: 'coverage.txt'
    }
  });
};

Unable to get coverage working with karma 0.12.1

Hello

We have an issue that happens with the last version of karma (0.12.1) and karma-coverage (0.2.1):

[gulp] Using gulpfile /Users/medianet/Documents/Work/bbva/wizzo_front_experiments/gulpfile.js
[gulp] Starting 'test'...
[gulp] Finished 'test' after 3.03 ms
INFO [karma]: Karma v0.12.1 server started at http://localhost:9123/
INFO [launcher]: Starting browser PhantomJS
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket dSKtK0fzmd_P7wgcpXOW with id 98803585
PhantomJS 1.9.7 (Mac OS X) ERROR
TypeError: 'undefined' is not an object (evaluating '__cov_w5iXYxo9oGaxixd5zUvm3A.s['2']')
at /Users/medianet/Documents/Work/bbva/wizzo_front_experiments/app/js/components/common/contact-picker-service.js:9
[ ... previous line gets repeated for each test ... ]

PhantomJS 1.9.7 (Mac OS X): Executed 0 of 0 ERROR (0.19 secs / 0 secs)
ERROR [karma]: [TypeError: Cannot call method 'att' of undefined]
TypeError: Cannot call method 'att' of undefined
at onBrowserComplete (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma-junit-reporter/index.js:50:11)
at null. (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/lib/events.js:15:22)
at EventEmitter.emit (events.js:117:20)
at onComplete (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/lib/browser.js:145:13)
at Socket. (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/lib/events.js:15:22)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/node_modules/socket.io/lib/namespace.js:335:22)
at Manager.onClientMessage (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/node_modules/socket.io/lib/manager.js:488:38)
at WebSocket.Transport.onMessage (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/node_modules/socket.io/lib/transport.js:387:20)
at Parser. (/Users/medianet/Documents/Work/bbva/wizzo_front_experiments/node_modules/karma/node_modules/socket.io/lib/transports/websocket/default.js:36:10)

Nothing gets prompt to the console neither the coverage folder get created.

We realised about this because we needed to reinstall our project several times during the week. With the previous karma version (0.12.0) worked fine.

We have karma installed locally and not globally. This was because we experiment problems updating plugins globally.

I am not sure if this issue belongs to your plugin or to karma itself, I realised that there are some problems when doing npm list that refer to fsevents and recursive-readdir. I will also report it to them.

Thanks for all the efforts and keep up the good work.

Greetings

Santi

CoffeeScript is incompatible with HTML report type

I've got karma-coverage 0.1.0 setup (using grunt-karma) and it seems to work fine on CoffeeScript files as long as the coverageReporter is set to type: 'text'. However, if I try to use type: 'html' it fails with:

ERROR [coverage]: [TypeError: Cannot set property 'covered' of undefined]

I found a related discussion on the karma-users Google Group with the same error reported.

Is there a way to get this and the CoffeeScript preprocessor to work together? I prefer the HTML format, and the only work-around I've come up with is to go through the regular build process and compile the CoffeeScript first, to a temporary directory, then run Karma (and karma-coverage) against it.

Not able to install

Running npm install -g karma-coverage I got the bellow error BTW I already got git installed

npm http GET http://registry.npmjs.org/karma-coverage
npm http 200 http://registry.npmjs.org/karma-coverage
npm http GET http://registry.npmjs.org/ibrik
npm http GET http://registry.npmjs.org/istanbul
npm http GET http://registry.npmjs.org/dateformat
npm http 200 http://registry.npmjs.org/istanbul
npm http 200 http://registry.npmjs.org/ibrik
npm http 200 http://registry.npmjs.org/dateformat
npm http GET http://registry.npmjs.org/optimist
npm http GET http://registry.npmjs.org/mkdirp
npm http GET http://registry.npmjs.org/escodegen
npm http GET http://registry.npmjs.org/which
npm http GET http://registry.npmjs.org/estraverse
npm http 200 http://registry.npmjs.org/optimist
npm http 200 http://registry.npmjs.org/which
npm http 200 http://registry.npmjs.org/mkdirp
npm http 200 http://registry.npmjs.org/escodegen
npm http 200 http://registry.npmjs.org/estraverse
npm http GET http://registry.npmjs.org/esprima
npm http GET http://registry.npmjs.org/escodegen/0.0.23
npm http GET http://registry.npmjs.org/handlebars
npm http GET http://registry.npmjs.org/nopt
npm http GET http://registry.npmjs.org/fileset
npm http GET http://registry.npmjs.org/abbrev
npm http GET http://registry.npmjs.org/wordwrap
npm http GET http://registry.npmjs.org/async
npm http GET http://registry.npmjs.org/resolve
npm http 200 http://registry.npmjs.org/escodegen/0.0.23
npm http 200 http://registry.npmjs.org/fileset
npm http GET http://registry.npmjs.org/escodegen/-/escodegen-0.0.23.tgz
npm http 200 http://registry.npmjs.org/nopt
npm http 200 http://registry.npmjs.org/handlebars
npm http 200 http://registry.npmjs.org/esprima
npm http 200 http://registry.npmjs.org/async
npm http 200 http://registry.npmjs.org/escodegen/-/escodegen-0.0.23.tgz
npm http 200 http://registry.npmjs.org/abbrev
npm http 200 http://registry.npmjs.org/wordwrap
npm http 200 http://registry.npmjs.org/resolve
npm http GET http://registry.npmjs.org/minimatch
npm http GET http://registry.npmjs.org/glob
npm http 200 http://registry.npmjs.org/glob
npm http GET http://registry.npmjs.org/source-map
npm http 200 http://registry.npmjs.org/minimatch
npm http GET http://registry.npmjs.org/uglify-js
npm http 200 http://registry.npmjs.org/source-map
npm http GET http://registry.npmjs.org/lru-cache
npm http GET http://registry.npmjs.org/sigmund
npm http 200 http://registry.npmjs.org/sigmund
npm http 200 http://registry.npmjs.org/lru-cache
npm http GET http://registry.npmjs.org/inherits
npm http 200 http://registry.npmjs.org/inherits
npm http 200 http://registry.npmjs.org/uglify-js
npm http GET http://registry.npmjs.org/amdefine
npm http 200 http://registry.npmjs.org/amdefine
npm ERR! not found: git
npm ERR!
npm ERR! Failed using git.
npm ERR! This is most likely not a problem with npm itself.
npm ERR! Please check if you have git installed and in your PATH.

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "karma-coverage"
npm ERR! cwd C:\Users\user
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! code ENOGIT
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\Users\user\npm-debug.log
npm ERR! not ok code 0

Do not preprocess files if reporter is not used

Based on karma-runner/karma#578

I think the best would be: if you set to use "coverage" preprocessor, but not set "coverage" reporter, show warning and disable the preprocessor to speed things up.

We could also show warning, if you set the reporter without preprocessor, as that's more likely a mistake.

Coverage Report Dumps .js.html files into same directory as covered files when karma conf file in separate directory

I've noticed the following possible bug:

When the karma conf file is in a separate directory from the files being tested, the coverage report files don't get placed in the coverage directory. Instead, the files get placed in the same directory as the files being covered.

Here's my karma conf file for reference:

module.exports = function(config) {
    config.set({
        basePath: './',
        autoWatch: true,
        frameworks: ['jasmine'],
        files: [
            '../public_html/libs/jquery/*.js',
            '../public_html/libs/mylib/lib.js',
            '../public_html/libs/mylib/utility.js',
            '../public_html/libs/mylib/config/*.js',
            '../public_html/libs/mylib/enumerations.js',
            '../public_html/libs/mylib/apiComm.js',
            '../public_html/libs/mylib/baseObject.js',
            '../public_html/libs/mylib/book.js',
            '../public_html/libs/mylib/file.js',
            '../public_html/libs/mylib/library.js',
            '../public_html/libs/mylib/publishing.js',
            '../public_html/libs/mylib/topic.js',
            '../test/*Spec.js'
        ],
        reporters: ['progress', 'coverage'],
        preprocessors: {
            '../public_html/libs/mylib/*.js': ['coverage']
        },
        port: 9876,
        colors: true,
        browsers: ['Chrome'],
        captureTimeout: 60000,
        singleRun: false
    });
};

Handle no configuration better

TypeError: Cannot read property 'dir' of undefined
at new CoverageReporter (/Users/vojta/Code/karma-coverage/lib/reporter.js:44:22)
at invoke (/Users/vojta/Code/karma/node_modules/di/lib/injector.js:75:15)
at Array.instantiate as 0
at get (/Users/vojta/Code/karma/node_modules/di/lib/injector.js:48:43)
at /Users/vojta/Code/karma/lib/reporter.js:50:75
at Array.forEach (native)
at createReporters (/Users/vojta/Code/karma/lib/reporter.js:38:9)
at Array.invoke as 0
at get (/Users/vojta/Code/karma/node_modules/di/lib/injector.js:48:43)
at get (/Users/vojta/Code/karma/node_modules/di/lib/injector.js:54:19)
at /Users/vojta/Code/karma/n

Naming convention not repected

If I understand the new naming convention for the plugins in Karma :
http://karma-runner.github.io/0.10/dev/plugins.html

The pre-processors like the Coffee pre-processor or the ng-hmlt2js pre-processor are named following the convention karma-*-preprocessor

Even so the name for the coverage plugin is "karma-coverage" however it's a pre-processor. So it's should be named "karma-coverage-preprocessor" to be consistent.

Karma-Coverage install error

npm install -g karma-coverage

I am getting following error :-

npm http 304 https://registry.npmjs.org/inherits
npm http 304 https://registry.npmjs.org/amdefine
npm ERR! git clone git://github.com/michaelficarra/CoffeeScriptRedux.git Cloning
into bare repository 'C:\Users\AppData\Roaming\npm-cache_git-remotes
git-github-com-michaelficarra-CoffeeScriptRedux-git-3c705430'...
npm ERR! git clone git://github.com/michaelficarra/CoffeeScriptRedux.git
npm ERR! git clone git://github.com/michaelficarra/CoffeeScriptRedux.git fatal:
unable to connect to github.com:
npm ERR! git clone git://github.com/michaelficarra/CoffeeScriptRedux.git github.
com[0: 192.30.252.130]: errno=No error
npm ERR! Error: Command failed: fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.252.130]: errno=No error
npm ERR!
npm ERR!
npm ERR! at ChildProcess.exithandler (child_process.js:637:15)
npm ERR! at ChildProcess.EventEmitter.emit (events.js:98:17)
npm ERR! at maybeClose (child_process.js:735:16)
npm ERR! at Process.ChildProcess._handle.onexit (child_process.js:802:5)
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\Program Files\nodejs\node.exe" "c:\Program Files\nodej
s\node_modules\npm\bin\npm-cli.js" "install" "-g" "karma-coverage"
npm ERR! cwd C:\Users
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11

Thanks,
Vijay

Request to update ibrik to 1.1.1

Could you update the ibrik dependency to 1.1.1?

The current version pointed to has a git dependency which has recently been fixed.

TIA!

Broken coverage, not covering coffee files

I'm working on a Meteor project CoinsManager, with RTD & Karma

As per rtd/#126, After writing unit tests that pass succesfully, my test runner fails at the test coverage checker.

This is strange, because the reports shows 100% tests (only 1 js file covered):

coverage

Also, if I try to make coffee files visible by coverage in my karma.conf.js with:

    preprocessors : {
        '**/app/**/*.js': 'coverage',
        '**/app/**/*.coffee': 'coverage',   # Line added!
        '**/*.coffee': 'coffee'
    },

I get this traceback

Any idea why the Test coverage checker fails ? And how to properly get my coffee files covered ?

Thank you for your support

Make ibrik optional to ease offline installation

Hi,

Recently I had to develop on a machine without internet access. I managed to install some npm packages offline but got stuck in this one because ibrik tried to fetch content from github. Though I could come out some dirty workarounds to overcome this. It was really frustrating because I had difficulties in downloading something that I don't use (I wrote only plain javascript).

Is it possible to make ibrik optional?

how to exclude directories from coverage preprocessor

Hi, I've been trying for a few hours now to exclude my test dirs from the coverage preprocessor, but I can't seem to find the right pattern. I was wondering if you could help me out.

I have multiple modules, which follow the same basic directory structure:

screen shot 2013-08-29 at 11 02 45

I'm looking for a pattern that will exclude everything in the test directory, but will instrument all the other files in the module (so the javascript-files in de models and views directories should be instrumented as well).

I've tried the following patterns:
src//!(test)//.js
src/__/!(test)/
.js
!/test//*.js

When I use that last pattern in a simple file that loads minimatch and test various paths it works as expected. However, when I put that pattern in the karma configuration, I get no files instrumented at all. I've also tried to first include all files, and then use the exclusion pattern to exclude the test files, but that didn't work either.

All Files link does not always link to correct file.

The All Files link does not always work. You can see from the first screenshot attached that my url is .../Chrome.../index.html. Then i click the /partial/login link and it takes me to the second screenshot where the url is .../Chrome.../partial/login/index.html

snap9

You can see from my mouse hovering over the All Files link that the path it's pointing to is .../Chrome.../partial/index.html which is incorrect and just takes me to a 404.

snap11

Output directory structure is super long.

I'd like to be able to generate links to the coverage test outputs but having directory names like this:

/coverage/Chrome 35.0.1916 (Mac OS X 10.8.5)/
/coverage/Firefox 29.0.0 (Mac OS X 10.8)/
/coverage/PhantomJS 1.9.7 (Mac OS X)/
/coverage/Safari 6.1.4 (Mac OS X 10.8.5)/

kind of makes it difficult to do that (because browsers upgrade frequently).

Is there a way that I can customize karma-coverage to output abbreviated paths? Something like:

/coverage/chrome/
/coverage/firefox/
/coverage/phantom/
/coverage/safari/

karma config

module.exports = function (config) {
  config.set ({
    basePath: '../',

    frameworks: ['mocha', 'requirejs', 'chai'],
    files: [
      'src/js/*',
      'tests/_*.js'
    ],
    exclude: [
       'lib/*'
    ],
    htmlReporter: {
      outputFile: 'tests/results/units.html'
    },
    reporters: ['mocha', 'html', 'coverage'],
    port: 9876,
    colors: true,
    captureTimeout: 60000,
    singleRun: false,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    preprocessors: {
      'src/js/*' : ['coverage']
    },
    coverageReporter: {
      type : 'html',
      dir: 'tests/results/coverage/'
    },
    browsers: ['Chrome', 'Firefox', 'PhantomJS', 'Safari']
  });
};

CoffeeScript coverage breaking on "class" keyword

Tried wiring up coverage in my Karma setup and the pre-processor is failing when it encounters a class declaration:

DEBUG [preprocessor.coverage]: Processing "/Users/jruscio/Documents/project/coffee/resolution.coffee".
ERROR [preprocessor.coverage]: Cannot read property 'loc' of undefined
  at /Users/jruscio/Documents/project/coffee/resolution.coffee
DEBUG [preprocessor.coffee]: Processing "/Users/jruscio/Documents/project/tests/coffee/resolution.spec.coffee".

If I remove the following two lines from the file (leaving in some other non-class CoffeeScript):

class MyClass
  foo: -> "bar"

it now works:

DEBUG [launcher]: /usr/local/bin/phantomjs /var/folders/rl/_66ww3s13k5bkcylj4w2n7y00000gn/T/karma-85644104/capture.js
DEBUG [preprocessor.coverage]: Processing "/Users/jruscio/Documents/project/coffee/resolution.coffee".
DEBUG [preprocessor.coffee]: Processing "/Users/jruscio/Documents/project/tests/coffee/resolution.spec.coffee".

Adding a 'checkCoverage' option to compare coverage with a defined threshold

At the moment it's not possible to run the 'check-coverage' command available in Istanbul. It would be cool to have a way of specifying thresholds for statement coverage, function coverage and branch coverage.

I was thinking something like

checkCoverage: {
   statement : 90,
   branch: 80,
   function: 100
}

to be added to the Karma conf file.

Thoughts?

Browserify + coverage doesn't work

If you use the karma-browserify plugin together with this plugin, it doesn't work. As far as I can tell, both preprocessors take the same files and then do their magic. What would actually be needed, is that the output of the first preprocessor is the input for the second one. Is there a solution to this?

npm install seemingly broken on Windows 7

I'm unable to install the package on my Windows 7 box. Any ideas?
Here is the npm-debug.log:

...
1013 verbose url resolved https://registry.npmjs.org/estraverse
1014 info trying registry request attempt 1 at 11:11:17
1015 verbose etag "59E22VNBV65YTR9JF0ASP28G0"
1016 http GET https://registry.npmjs.org/estraverse
1017 warn git config --get remote.origin.url returned wrong result (https://github.com/michaelficarra/CoffeeScriptRedux.git)
1018 silly gunzTarPerm extractEntry lib/report/json.js
1019 silly gunzTarPerm modified mode [ 'lib/report/json.js', 438, 420 ]
1020 silly gunzTarPerm extractEntry lib/report/lcov.js
1021 silly gunzTarPerm modified mode [ 'lib/report/lcov.js', 438, 420 ]
1022 error git clone https://github.com/michaelficarra/CoffeeScriptRedux.git
1023 silly lockFile 0413540b-aelficarra-CoffeeScriptRedux-git https://github.com/michaelficarra/CoffeeScriptRedux.git
1024 verbose about to build c:\a\node_modules\karma-coverage\node_modules\ibrik
1025 info c:\a\node_modules\karma-coverage\node_modules\ibrik unbuild
1026 info preuninstall [email protected]
1027 info uninstall [email protected]
1028 verbose false,c:\a\node_modules,c:\a\node_modules\karma-coverage\node_modules unbuild [email protected]
1029 verbose c:\a\node_modules\karma-coverage\node_modules.bin,[object Object] binRoot
1030 info postuninstall [email protected]
1031 silly gunzTarPerm extractEntry lib/report/html.js
1032 silly gunzTarPerm modified mode [ 'lib/report/html.js', 438, 420 ]
1033 silly gunzTarPerm extractEntry lib/report/none.js
1034 silly gunzTarPerm modified mode [ 'lib/report/none.js', 438, 420 ]
1035 silly gunzTarPerm extractEntry lib/report/teamcity.js
1036 silly gunzTarPerm modified mode [ 'lib/report/teamcity.js', 438, 420 ]
1037 silly gunzTarPerm extractEntry lib/report/text-summary.js
1038 silly gunzTarPerm modified mode [ 'lib/report/text-summary.js', 438, 420 ]
1039 silly gunzTarPerm extractEntry lib/report/text.js
1040 silly gunzTarPerm modified mode [ 'lib/report/text.js', 438, 420 ]
1041 silly gunzTarPerm extractEntry lib/report/lcovonly.js
1042 silly gunzTarPerm modified mode [ 'lib/report/lcovonly.js', 438, 420 ]
1043 silly gunzTarPerm extractEntry lib/report/templates/foot.txt
1044 silly gunzTarPerm modified mode [ 'lib/report/templates/foot.txt', 438, 420 ]
1045 silly gunzTarPerm extractEntry lib/report/templates/head.txt
1046 silly gunzTarPerm modified mode [ 'lib/report/templates/head.txt', 438, 420 ]
1047 silly gunzTarPerm extractEntry lib/store/fslookup.js
1048 silly gunzTarPerm modified mode [ 'lib/store/fslookup.js', 438, 420 ]
1049 silly gunzTarPerm extractEntry lib/store/index.js
1050 silly gunzTarPerm modified mode [ 'lib/store/index.js', 438, 420 ]
1051 verbose about to build c:\a\node_modules\karma-coverage
1052 info c:\a\node_modules\karma-coverage unbuild
1053 info preuninstall [email protected]
1054 info uninstall [email protected]
1055 silly gunzTarPerm extractEntry lib/store/memory.js
1056 silly gunzTarPerm modified mode [ 'lib/store/memory.js', 438, 420 ]
1057 silly gunzTarPerm extractEntry lib/store/tmp.js
1058 silly gunzTarPerm modified mode [ 'lib/store/tmp.js', 438, 420 ]
1059 verbose true,c:\a\node_modules,c:\a\node_modules unbuild [email protected]
1060 info postuninstall [email protected]
1061 silly gunzTarPerm extractEntry lib/util/factory.js
1062 silly gunzTarPerm modified mode [ 'lib/util/factory.js', 438, 420 ]
1063 silly gunzTarPerm extractEntry lib/util/file-writer.js
1064 silly gunzTarPerm modified mode [ 'lib/util/file-writer.js', 438, 420 ]
1065 error Error: ENOENT, lstat 'c:\a\node_modules\karma-coverage\node_modules\istanbul\lib\command\test.js'
1066 error If you need help, you may report this entire log,
1066 error including the npm and node versions, at:
1066 error http://github.com/isaacs/npm/issues
1067 error System Windows_NT 6.1.7601
1068 error command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
1069 error cwd c:\a
1070 error node -v v0.10.23
1071 error npm -v 1.3.17
1072 error path c:\a\node_modules\karma-coverage\node_modules\istanbul\lib\command\test.js
1073 error fstream_path c:\a\node_modules\karma-coverage\node_modules\istanbul\lib\command\test.js
1074 error fstream_type File
1075 error fstream_class FileWriter
1076 error code ENOENT
1077 error errno 34
1078 error fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
1078 error fstream_stack Object.oncomplete (fs.js:107:15)
1079 verbose exit [ 34, true ]

I should note that for line 1065, the .js file (test.js in this example) is frequently different.

I hope this is the correct place to post this, I'm able to npm install -g istanbul successfully so I don't think the problem is there.

Sorry if this is noise

Coverage missing for multiple browsers configuration

Given the default setup for coverage reporter. The result is correct if I only specify one browser.
screen shot 2013-08-07 at 8 58 26 pm

When I specify multiple browsers for karma to run, istanbul generates the correct coverage folder structure and files but lack the analytic data.
screen shot 2013-08-07 at 8 57 31 pm

Coverage on v0.12

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'
  }
};

making coverage directory browseable

Problem:
When you run test coverage report it creates a folder containing the report and a json file. However, when your connect test server starts up you see a blank screen.

image

Solution:
Use grunt connect options to make the directory browseable. You no longer see a blank screen and can click on the folder to view the coverage report - without having to manually copy+paste the folder name into the url.

image

I've put the code into a GIST: https://gist.github.com/sdeering/8035033

Support for multiple reporter types

Can we support something like

 coverageReporter: [{
      type : 'html',
      dir : 'coverage/'
 }, {
     type: 'text-summary'
 }]

to be able to generate different coverage report types at the same time.

dir setting not applied to all html report files

Hi, I've got following reporters setup in karma.conf.js:

    coverageReporter: {
      reporters:[
        {type: 'html', dir:'coverage/'},
        {type: 'teamcity'},
        {type: 'text-summary'}
      ],
    },

when I run grunt test, I get directory created in . called coverage containing 1 json file and coverage directory in ./test containing Chrome... (which in turn has index.html etc.)

Is there any way of saving all reports to test/coverage?

using v0.1.5

Many thanks

Output directory not being used per reporter

The example:

coverageReporter: {
  reporters:[
    {type: 'html', dir:'somedir/'},
    {type: 'teamcity'},
    {type: 'text-summary'}
  ],
}

Does not output html to somedir/, I think because of https://github.com/karma-runner/karma-coverage/blob/master/lib/reporter.js#L44 which only takes into account the directory of the coverageReporter object.

So if you specify as follows:

coverageReporter: {
  dir:'somedir/',
  reporters:[
    {type: 'html'},
    {type: 'teamcity'},
    {type: 'text-summary'}
  ],
}

HTML will be output to somedir/. Of course, this means that you can't have different directories for each reporter, so I think this is a bug.

IE cache affecting the karma coverage

I found that something wrong with my karma coverage.

Here is my preprocessors and browser configuration:
preprocessors: {
'lib/src/src1.js' : ['coverage'],
'lib/src/src2.js' : ['coverage']
},
browsers: ['IE', 'Chrome'],

Firstly, reports in both IE and Chrome show the coverage correctly. Then I remove 'lib/src/src1.js' in my preprocessors's configuration. This time, report of Chrome shows only about src1.js's coverage. However, IE report still shows the coverage of both src1.js and src2.js.

I was wondering that if this is affected by the IE cache. So I clear the IE cache thoroughly. Magically, reports in IE and Chrome are correct again.

How can I fix this issue ??? Is there any wrong with my configurations ??? Or is there any version of karma-coverage fix this bug???

ps. I had tested in both IE10 and IE11, windows 7. It comes the same result.

Many thx!!

Document JSON reporter

I had to go the long way around to find out that the HTML reporter no longer produced JSON files. This should be documented here and in the README.

Karma-coverage not considering all javascript for test coverage

I have more than 10 Javascripts and I have covered test script for two Javascript sources.

Javascript source code is using Durandal/RequireJS and test script is written in Jasmine.

When I run karma start and see test coverage report in PhantomJs/Chrome, it is showing report of only 2 Javascript that has test scripts.

Why Karma-Coverage is not showing report for other JS source ?

I am expecting to list all JS and show coverage as 0%.

Do I need to configure the karma.config.js to show all JS ?

Thanks,
Vijay

Karma-coverage npm install error on Jenkin's server

I am getting following error on Jenkins but not on my local box.
Can any one give me the resolution for this error. Thanks

building:
[exec] npm WARN package.json [email protected] No README data
[exec] npm http GET https://registry.npmjs.org/karma-coverage
[exec] npm http 304 https://registry.npmjs.org/karma-coverage
[exec] npm http GET https://registry.npmjs.org/ibrik
[exec] npm http GET https://registry.npmjs.org/dateformat
[exec] npm http GET https://registry.npmjs.org/istanbul
[exec] npm http 304 https://registry.npmjs.org/ibrik
[exec] npm http 304 https://registry.npmjs.org/istanbul
[exec] npm http 304 https://registry.npmjs.org/dateformat
[exec] npm http GET https://registry.npmjs.org/which
[exec] npm http GET https://registry.npmjs.org/escodegen
[exec] npm http GET https://registry.npmjs.org/optimist
[exec] npm http GET https://registry.npmjs.org/mkdirp
[exec] npm http GET https://registry.npmjs.org/estraverse
[exec] npm ERR! Error: ENOENT, lstat 'http://myurl.com/jenkins/job/myproject/ws/myproject-resources/node_modules/karma-coverage/node_modules/istanbul/lib/report/teamcity.js'
[exec] npm ERR! If you need help, you may report this entire log,
[exec] npm ERR! including the npm and node versions, at:
[exec] npm ERR! http://github.com/isaacs/npm/issues
[exec]
[exec] npm ERR! System Windows_NT 6.1.7601
[exec] npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
[exec] npm ERR! cwd http://myurl.com/jenkins/job/myurl/ws/myproject-resources
[exec] npm ERR! node -v v0.10.24
[exec] npm ERR! npm -v 1.3.21
[exec] npm ERR! path http://url.com/jenkins/job/myproject/ws/myproject-resources/node_modules/karma-coverage/node_modules/istanbul/lib/report/teamcity.js
[exec] npm ERR! fstream_path http://myurl.com/jenkins/job/myproject/ws/myproject-resources/node_modules/karma-coverage/node_modules/istanbul/lib/report/teamcity.js
[exec] npm ERR! fstream_type File
[exec] npm ERR! fstream_class FileWriter
[exec] npm ERR! code ENOENT
[exec] npm ERR! errno 34
[exec] npm ERR! fstream_stack C:\Program Files\nodejs\node_modules\npm\node_modules\fstream\lib\writer.js:284:26
[exec] npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
[exec] npm ERR! not found: git
[exec] npm ERR!
[exec] npm ERR! Failed using git.
[exec] npm ERR! This is most likely not a problem with npm itself.
[exec] npm ERR! Please check if you have git installed and in your PATH.
[exec]
[exec] npm ERR! System Windows_NT 6.1.7601
[exec] npm ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install"
[exec] npm ERR! cwd http://myurl.com/jenkins/job/myproject/ws/myproject-resources
[exec] npm ERR! node -v v0.10.24
[exec] npm ERR! npm -v 1.3.21
[exec] npm ERR! code ENOGIT
[exec] npm http 304 https://registry.npmjs.org/which
[exec] npm http 304 https://registry.npmjs.org/mkdirp
[exec] npm http 304 https://registry.npmjs.org/estraverse
[exec] npm http 304 https://registry.npmjs.org/escodegen
[exec] npm http 304 https://registry.npmjs.org/optimist
[exec] npm
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:

0.2.3 causes problems trying to find instrumenter

If I use the 0.2.1 package and the following karma directives:

reporters: ['progress', 'coverage'],
preprocessors : {
    './app/js/**/*.js': 'coverage',
    './common/**/*.js': 'coverage'
}

The coverage tool works correctly. If I upgrade to 0.2.3 I get the following error:

[INFO] WARN [preprocess]: Can not load "coverage"!
[INFO] TypeError: Cannot read property 'instrumenter' of undefined
[INFO] at createCoveragePreprocessor (C:\desktop\node_modules\karma-coverage\lib\preprocessor.js:7:47)
[INFO] at Array.invoke as 0
[INFO] at [object Object].get (C:\desktop\node_modules\karma\node_modules\di\lib\injector.js:48:43)
[INFO] at instantiatePreprocessor (C:\desktop\node_modules\karma\lib\preprocessor.js:65:37)
[INFO] at Array.forEach (native)
[INFO] at C:\desktop\node_modules\karma\lib\preprocessor.js:86:31
[INFO] at C:\desktop\node_modules\karma\lib\file_list.js:219:17
[INFO] at Object.oncomplete (fs.js:107:15)

I have to return to 0.2.1 to get this working again.
Please advise. The supporting modules (istanbul and ibrik appear to be there).

Thank you.

Problems with coffeescript coverage

When coffeescript coverage is enabled, it isn't able to handle coffeescript ~1.7 features like this:

angular.module 'foo'

.factory

Which should be interpreted as angular.module('foo').factory(...) instead of angular.module('foo'.factory(...))

karma-coverage - includeBaseLine flag

I set includeBaseLine to true in my karma config.
It works fine when I applied changes manually as per issue number 11.

ThomasYoung283@dc5b03e

Can you pls. let me know the correct repository url and karma-coverage version number to pull your karma-coverage changes in package.json

I want to integrate with Sonar and display complete code coverage

{
"name": "ng-directive-testing",
"version": "0.0.0",
"description": "An example of testing AngularJS directives with Karma.",
"main": "",
"scripts": {
"test": "karma start --single-run --no-auto-watch"
},
"repository": {
"type": "git",
"url": "git://github.com/vojtajina/ng-directive-testing.git"
},
"author": "Vojta Jina [email protected]",
"license": "MIT",
"devDependencies": {
"karma": "~0.10.8",
"karma-jasmine": "~0.1.3",
"karma-chrome-launcher": "~0.1.1",
"karma-phantomjs-launcher": "~0.1.1",
"karma-ng-html2js-preprocessor": "~0.1.0",
"karma-coverage": "~0.1.4",
"karma-junit-reporter": "~0.2.1"
}

Thanks,
Vijay

"Can not load "coverage", it is not registered!" error when running

I install karma-coverage like this:
npm install karma-coverage --save-dev

I have a package file that contains this:
"devDependencies": {
"karma": "0.10.2",
"karma-coverage": "0.1.5",
"karma-junit-reporter": "0.1.0",
"karma-jasmine": "0.1.3",
"karma-chrome-launcher": "0.1.0",
"karma-ie-launcher": "0.1.1",
"karma-safari-launcher": "0.1.1",
"karma-firefox-launcher": "0.1.0"
},

And a config file that looks contains this:
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['dots', 'junit', 'coverage'],

preprocessors: {
  // source files, that you wanna generate coverage for
  // do not include tests or libraries
  // (these files will be instrumented by Istanbul)
  'jstarget/**/*.js': ['coverage']
},

// configure the coverage reporter
coverageReporter: {
  type : 'html',
  dir : 'coverage/'
},

And I get an error that looks like this:
WARN [reporter]: Can not load "coverage", it is not registered!
Perhaps you are missing some plugin?

What do I need to do?

Wrong coverage report in karma

I've configured my karma.conf.js with enabled preprocessing to get a report about the code coverage of my tests. I've added this line to the preprocessors section.

preprocessors: {
  'public/js/app.js': ['coverage'],
  'public/js/filters.js': ['coverage'],
  'public/js/directives.js': ['coverage'],
  'public/js/services/*.js': ['coverage'],
  'public/js/controllers/*.js': ['coverage'],
},

What I'm get is a report that is totally wrong. I know that I've written tests for each modules and the function within. But the coverage report shows me only the tests for the services correctly.

For instance the tests for directives. I know that I've written some tests and the tests will also be executed. But the report shows me that I've just tests for 36% of my code lines.

Coverage Report

What could be the reason for this strange behavior?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.