My stack is: Angular.js, Karma, Karma-coverage (Istanbul) and Jasmine.
I have been running Code Coverage analysis over my app, the problem, and thus the question, is that I get Service A marked as covered by tests (in green) when it actually does not have any tests associated.
I suspect that the following scenario is to blame:
- I know that Service A is used by Controller B.
- Controller B is covered by tests, and the Code Coverage results mark it correctly as covered by tests.
- Service A is not being mocked when testing Controller B.
I think that since service A is indirectly called by Controller B's tests, I get the wrong result.
Any ideas? Am I suspecting the right thing? Is there any ways around it so I can get an accurate test coverage result in this aspect?
Thanks in advance!