We have a unique situation with the code coverage of our project involving a node dependency. It's important to note that the npm dependency source code is actually part of our project, as we are responsible for its development and publication. Here's an overview of the project structure:
- root
- main_project
- karma.conf.ts
- src and other files to be tested and for which the coverage is to be generated
- test
- side_project which is packaged and published to npm and used across multiple projects including this one
- src etc.
- main_project
Despite the karma config being located within the main_project folder, where we want to focus on testing and generating coverage, karma includes the side_project in the coverage report as well. You can see this illustrated here: https://i.sstatic.net/3CwRK.png
Below is the relevant karma configuration:
const testRecursivePath = "test/*Test.ts";
const srcOriginalRecursivePath = "src/**/*.ts";
frameworks: ["jasmine"],
reporters: [
"progress",
"junit",
"coverage-istanbul"
],
files: [
testRecursivePath,
{
pattern: srcOriginalRecursivePath,
included: false,
served: true
}
],
preprocessors: {
[testRecursivePath]: ["webpack", "coverage"]
},
If anyone could offer assistance with this issue, it would be greatly appreciated.