Open rhymes opened 7 years ago
I'm having the same issue :(
I'm also having the exact same issue.
The coverage mode causes the preprocessor to add lines to count usage, causes the test run to record the counts, and writes the data out. Just investigate each step to see where you go off the track.
I just fixed it. For me, the issue was in the preprocessors section. The way that I fixed it was to repeat the same code that generates the "files" section of my config. This code is the part that uses sprockets. Once I did that, it worked like a charm. The bad news is that I'm < 50% coverage everywhere.
For me, the problem was that I wasn't including all of the files. For you, it seems that you need to add this line:
'test/javascripts/**/*_test.js': ['coverage']
to the end of your preprocessors list.
Hi,
Karma seems to work fine running the tests but I can't get any coverage output. I am using a Rails app with yarn installed modules, sprockets (asset pipeline) and karma + phantomjs.
Through Google (and this 4 year old article) I came up with the following karma.conf.js:
I've tried with both:
and
but nothing. Even both at the same time.
application.js is the file that Rails bundles with all the JS dependencies and which karma picks up fine to run the tests.
As you can see from the debug output, the preprocessor is actually seeing the project files:
I had a look in https://github.com/karma-runner/karma-coverage/issues/87 but I couldn't come up with a solution.
These are my package.json devDependencies (the app is a regular web site with jQuery and some JS business logic)
Any ideas?
Thank you!