I have an app
directory structure like
scripts/sequoia/
├── GraphToolbar.js
├── nodes
│ ├── activityNode.js
│ └── annotationNode.js
├── OverviewCanvasControl.js
└── settings
├── GraphControlSettingsFactory.js
└── SnapContextFactory.js
My test
directory current looks thus
test/spec/
├── GraphToolbarSpec.js
├── settings
│ ├── graphControlSettingsFactorySpec.js
│ └── snapContextFactorySpec.js
└── test-main.js
Note that I only have GraphToolbar
and the settings/
files covered so far; there are no tests yet for OverviewCanvasControl.js
or the nodes/
files.
In my karma.conf.js
(coverage
refers to karma-coverage
):
preprocessors: {
'scripts/sequoia/**/*.js': ['coverage']
},
reporters: ['progress','coverage'],
When I run karma, the coverage preprocessor & reporter run, but it only checks the files that already have specs written. I want to be reporting 0% coverage for OverviewCanvasControl.js
and the nodes/
files that have no coverage. When a new file is created & karma is run, I want it to catch that that file has no Spec yet.
How can I get Karma to check all matching source files for coverage, not just those with specs already created?
After searching for I while I found that it is quite easy. Add this to your karma.conf.js:
coverageReporter: {
includeAllSources: true,
reporters: [
...
]
}
BR Chris