New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
karma coverage does not show any data #87
Comments
An update to the above: However, next run of the tests did not update the data as the old data was still showing.(Checked the timestamp of the run). Now i deleted the reports directory and ran the tests again. No data is displayed in the report. Not sure where i am doing wrong. |
Same issue as @priyabrat1801. I'm wondering if it has something to do with basePath. |
I have the same behavior. Tests run fine, even browserified, but coverage is 100% with "no data to display". My tests are in From my package.json:
From my Gruntfile:
When I run
But when I change the
...I get:
And I have coverage reports for adapter.js of karma-mocha :D |
Same problem, previous solutions did not work. tests run fine, 100% pass, html report is also being created. in the debug information i can see
messages pass by and also later on:
Below my karma.conf.js:
Any idea what could be causing it ? |
the same problem here. any ideas? |
So, somehow, without me touching anything related to karma-coverage, it started to generate lcov.info a few commits later. I have no idea what caused this, kind of stochastic behaviour if you ask me. Might it be related to one of my jasmine tests failing? but that should not matter right? weird. |
+1... my samples would show the same thing others are reporting. Using any of the formatters I see 100% coverage & no files reported when I add a single function that has no tests applied. |
+1 |
I was having this problem today and eventually narrowed it down to one of my jasmine tests which was calling $(window).trigger('beforeunload'). This caused Phantom to throw an error (" some of your tests did a full page reload!") and in turn also caused the coverage pass to stop, it seems. When I removed that line from the test I got full coverage results once more. (Oddly enough that test was listed as passing in the results, but not all tests were being executed). |
Same problem here. Using any of the formatters I see 100% coverage & no files reported. The tests are successfull. |
Exact same problem here for PhantomJS 1.9.8 |
Hmm, not sure how much this will help other people, but this worked for me. I reverted my jasmine-core to version 2.0.4, and things seem to be working ok. The newer version seems to have caused some small problems over at karma-jasmine, so maybe this is related? The process still "hangs" on completion and doesn't close PhantomJS properly, but the coverage and HTML reports are all there, which was not the case before. |
+1 as I am also seeing 100% coverage with no files though I have 52 passing tests. I'm pretty sure its my preprocessors. It's not using a standard glob pattern (or at least that's not working for me). I need to include some files and exclude others. Any new news on this?
|
Turns out it was the minimatch and the file exclusions, which is what I thought (and feared). Glob patterns or even regex (gasp) would be more straightforward. this ended up solving my problem, to exclude .spec.js files
|
+1 same issue here. Empty coverage report generated for both chrome 40.0.2214 and PhantomJS 1.9.8. karma.conf.js
module.exports = function(config) {
config.set({
node v0.10.35 In debug.html, I do see that the source code under test is instrumented. However the generated report is blank with 'No data to display'. I have tried all possible suggestions so far, still no luck. Is there a way i can debug reporter ? |
The issue was resolved after altering the order of loading files as explained at http://stackoverflow.com/questions/26850684/karma-coverage-requirejs-misleading-coverage-reports. Keeping the above configuration as is, I changed test-main.js to the following -
|
Hello everyone! Did example on top helps for anybody ? |
I'm not sure if I'm experiencing exactly the same thing. Using karma-coverage ~0.3, my lcov.info ends up empty, though the 'text-summary' reporter works properly. When I downgrade to karma-coverage ~0.2, everything works properly again. I thought it might be a regression of karma-runner/karma#892? |
i can confirm @mhelvens report: running karma-coverage ~0.3 produces the |
Does anyone have a repo that reproduces this issue consistently? |
My repo has this issue Run this using the command |
bump |
thanks @anshbansal I will try to take a look as soon as I can |
I'm not totally sure how related this is but after running into the same issues as others on this thread I looked back into a project I worked on that had this working. The vital config for me was to require browserify-istanbul in my karma.config.js:
and set this config:
Not totally sure what this points to other than a possible issue with karma-browserify perhaps, but maybe it can help someone... |
+1 some issue in my repo |
It's been 18 days an no update on this issue. Any resolution to this as it seems a lot of people including myself get zero results for code coverage. |
@anshbansal the repro, was not a real repro I'm afraid, the issue was that the coverage preprocessor was not properly matching any files: anshbansal/linksharing2#1 @jperry I'm sorry, that it's not working for you, but I'm working alone on all of karma, mostly at nights, and the coverage reporter is not something I use at all, so while I do understand that you are frustrated about it not working, please be a bit more constructive and maybe try figuring out yourself where the issue lies. |
@qiu8310 posted in your repo, not seeing an issue there |
@dignifiedquire -sorry about that. I have been looking at it all morning and haven't found how to fix it. Here is my karma.conf.js
My devDependencies are like so:
My project is pretty small
Maybe I'm missing something obvious in my file patterns. |
I think the issues is that you are missing the source files, in the files: [
'app.js',
'routes/**/*.js',
'spec/**/*.spec.js'
], |
@dignifiedquire - I did try that before and I got this:
|
Hmm, strange, any chance you could give me temporary access to the code? |
@dignifiedquire - sorry I can't. I could try stripping a bunch out and leave some boilerplate code in there. |
@dignifiedquire - I created a simple repository to show one that doesn't generate results. |
@jperry thanks, I think I know what the issue is. So the setup you have is an express app, that serves up some routes, and then you want to test those routes through karma. But this will not work with |
@dignifiedquire - thank you. We actually did as you suggested and used jasmine and istanbul directly. We are now getting code coverage reports. Thanks for the tip. |
@jperry glad to hear. Closing, as this issue has been resolved, and the remaining issues seem to be configuration problems. |
I found an issue with order of reporters. Try this and it will work!
|
I have this issue with latest -- I'm only using one reporter -- it doesn't seem to be a configuration problem -- I can resolve the issue with the hack to test-main.js that was posted by @dhrubach. -- Seems like the issue is real. |
Is there a problem with karma-coverage itself, or with using it in conjunction with other npm modules? Wasn't @dhrubach 's fix for compatibility with RequireJS? |
@andy-dorman thank you, was using Browserify (with Grunt & Karma) - your note got me up and running! |
I've been having the same issue. tried all solutions in here. I'm using webpack, karma, jasmine and been trying to generate coverage report to no avail. It's been coming out empty. |
+1 |
+1 Same for me. Using webpack, karma, jasmine. If I choose to show the coverage output in the console, it works fine. If I choose to output as html, the html is generated, but it shows 100% (0/0) for everything, and doesn't display any data in the table below. |
I've had similar issue with browserify + babel + karma. Take a look here. Key to my setup was to add ["istanbul"] into babel plugins. |
that worked! thanks @stsvilik thanks! |
I was facing the same issue. My Debug Log showed that files were being processed, however a coverage report was not being generated.
|
For some reason all these tutorial are missing the part about the entirely separate webpack plugin: istanbul-instrumenter-loader. So I am dropping it here for consistency. Setting up webpack with istanbul-instrumenter-loader set me on the right track. |
@CATIGERN , thanks very much, it helps a lot, finally it works,hahahah |
Hello there from 2018. Sorry for archeology, but I have just migrated from phantomjs to puppeteer and faced with that issue. I work with webstorm and usualy it happens when I run single test suite. WS then show me this message as below and doesn't show coverage info to me. Absolutely random thing. Sometimes I get coverage, sometimes - not. Cannot find karma test coverage report - lcov.info
|
I ran into this issue when using rollup + babel + karma. I fixed it by using Then, use babel as a karma plugin, and do not include
|
if you use webpack or other utils to transform your sourcecode you should use istanbul before |
hi friend this problem already solved preprocessors: { 100% will solve your problem |
I have included the source files in the files & preprocessors section of my karma conf file. The tests run fine and the junit xml report shows the data. The html coverage just show 100% without any data. I have the similar structure for another project which is working fine but not this one. Not sure if i am missing something. Might be a very minor or silly thing i have missed.
karma.conf.js:
my karma conf file is in test -> spec -> conf
and source files are in app -> js -> controllers/directives/services
the debug log shows its loading all the files in preprocessors but the report does not show any data "No data to display".
The text was updated successfully, but these errors were encountered: