I am trying to achieve code coverage for source code from e2e tests. I used nyc npm module for coverage. It's able to provide coverage report on e2e tests files including page object files, but there is no coverage report for actual source file. Coverage report on e2e files just gives an idea how much of testing code is actually executed, but what what features are covered by e2e tests is not extracted.
Is there any way we can get feature source code files coverage from e2e tests?
Here is the code for getting coverage report.
- install nyc npm module.
- Add .nycrc.json at project root folder.
- Execute command nyc protractor protractor.conf.js
.nycrc.json file looks like this.
{
"include": [
"src/**/*.ts",
"e2e/**/*.ts"
],
"exclude": [
"/**/*.spec.ts",
"**/*.d.ts"
],
"extension": [
".ts"
],
"reporter": [
"text",
"lcov"
]
}
It generates the report files but only for test code.