Currently, it can't. I'm not sure there's tons of value in getting code coverage from integration tests - I think unit test code coverage is somewhat valuable, but I don't find it very meaningful for end to end tests. Beyond that, there's some technical questions - what if your JS is minified? Do you care about server side code coverage?
If others disagree feel free to articulate your reasons and open up a feature request.
Hi.
I use backend rest api and my controllers in most cases are very simple, so that I don't see any reason to write unit tests. But I want to test my app using e2e tests. And I want to measure code coverage just to be sure that I didn't miss something in my tests.
FYI - I've made a Grunt plugin that can capture code coverage from Protractor:
https://www.npmjs.org/package/grunt-protractor-coverage
@r3b : Does your plugin https://www.npmjs.org/package/grunt-protractor-coverage works with angular types script files?
@r3b @chetanladdha can one of you please tell if the grunt-protractor-coverage works with angular type script files.?
@r3b: from my tests withing the @GlobaLeaks project currently your plugin do not work with protractor 6 / selenium 5 specifically in relation to "async" functions that appear to not be defined.
@chetanladdha / @svanishree: maybe some of you have already identified a solution?
@cnishina, @juliemr: by any chance do you have a working recipe for collecting coverage on protractor 6?
thank you!
I got a solution to one of my StackOverflow question. As per answer, a person found the solution.
https://stackoverflow.com/questions/50351276/code-coverage-for-protractor-tests-in-angular-5-application/56910948#56910948
Thank you @chetanladdha, actually i tried to use the same solution but i encountered this issue: https://github.com/istanbuljs/nyc/issues/1117
In the end I managed to managed to handle this using an inline plugin defining postTest and using the onComplete callback: https://github.com/globaleaks/GlobaLeaks/blob/master/client/tests/protractor-coverage.config.js
@cnishina sjelin: i think that this could be recommended as a solution in the documentation.
Most helpful comment
Currently, it can't. I'm not sure there's tons of value in getting code coverage from integration tests - I think unit test code coverage is somewhat valuable, but I don't find it very meaningful for end to end tests. Beyond that, there's some technical questions - what if your JS is minified? Do you care about server side code coverage?
If others disagree feel free to articulate your reasons and open up a feature request.