Background
We have an existing a huge angular application without any unit tests and we have just started writing the test cases. When I run the command
ng test --code-coverage
Problem
I see all the *.ts files in the report. However, I just need the code coverage of 3 files for which I have created .spec files in my app and not all of them.
What I tried
After reading different stackoverflow posts it seems that there are some options files
and preprocessor
to be added in the tsconfig.json, and I could add my files like this:
"files": [
"src/app/products/details/activity/timeline.component.ts",
],
"preprocessors": {
"src/app/products/details/activity/timeline.component.ts": ["coverage"],
},
Question
But this does not seem to work and I still see all the files in the coverage report. How do I tell Angular/Karma/Istanbul to only show coverage of the files for only the files for which I wrote test cases.