vigetlabs / blendid

A delicious blend of gulp tasks combined into a configurable asset pipeline and static site builder
MIT License
4.97k stars 680 forks source link

Karma coverage incorrect #307

Closed branpar closed 7 years ago

branpar commented 8 years ago

Hello,

Thanks for the starter kit, it's awesome. I've been working with it, adapting it to my companies environment, and ran into an issue. I'm trying to include front-end testing for our JS modules, and I've got that, but we rely heavily on external libraries like jQuery and lodash that we use in our modules. When I run my tests the code coverage is extremely low. It's trying to check for tests for all of the external libraries.

Also, a similar issue, I have some test files created that don't have any tests yet. I get 100% coverage for lines and functions (because there are none) but 50% coverage for statements, because it seems to be checking the code that webpack injects into the file when it's transpiled.

I've tried posting to Stack Overflow for both of these issues with no luck. For code samples you can see them in the Stack Overflow posts:

Karma Code Coverage Incorrect with Webpack: http://stackoverflow.com/questions/37622303/karma-code-coverage-incorrect-with-webpack Exclude jQuery Require from Code Coverage Report: http://stackoverflow.com/questions/37573412/exclude-jquery-require-from-code-coverage-report

Any help or tips you can provide on how to get coverage to be correct would be greatly appreciated!

greypants commented 7 years ago

Sounds like a configuration issue with whatever you're using for code coverage. I've used karma-coverage/istanbul in the past with success.