Currently using Angular.js, Karma, Karma-coverage (Istanbul), and Jasmine for my stack.
While conducting Code Coverage analysis on my app, I encountered an issue which leads to my question - Service A is showing up as covered by tests (in green) even though it actually has no associated tests.
I have a suspicion that the cause of this issue might be:
- Service A is utilized by Controller B.
- Controller B has test coverage results displaying accurately as covered by tests.
- However, while testing Controller B, Service A is not being mocked.
It seems like due to Service A indirectly being called by the tests of Controller B, the incorrect result is being obtained.
Any insights or suggestions? Is my suspicion correct? Are there any workarounds to ensure accurate test coverage results in this scenario?
Appreciate your help!