includeAllSources does not work as expected
See original GitHub issueFrom the documentation:
“You can opt to include all sources files, as indicated by the coverage preprocessor, in your code coverage data, even if there are no tests covering them.”
https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md#includeallsources
However, with the following karma.conf.js
https://gist.github.com/schalkneethling/ccb6d61ef84e5a2e0107
When I run my grunt test
target, the coverage report only shows the JS for which tests exist and nothing else. This leads me to believe that the includeAllSources
flag does not work as advertised.
I have read the issue here https://github.com/karma-runner/karma-coverage/issues/11 logged almost two years ago, and the resulting PR, https://github.com/karma-runner/karma-coverage/pull/76
Both are still open however, and I am wondering whether the addition of includeAllSources superseded the above? In either case, having full test coverage for all JS, even is there are no tests for it, is what I believe most (perhaps even all) people would want and need.
It would be great if this issue could be resolved soon. Thank you.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6
Hi there. For anyone still interested in this topic, Here is a tool, which helps to add untested files to coverage report. It works fine with both JavaScript and TypeScript files. https://github.com/kopach/karma-sabarivka-reporter Karma has limitation in detecting all source files, in case we pass only 1 file as starting point to our tests. This tool overcomes this limitation.
facing the same issue. any help ? also trying to use karma-coverage-allsources https://www.npmjs.com/package/karma-coverage-allsources does not help. Apparently I get an error “could not load coverage-allsources it is not registered, Perhaps are you missing some plugin”.