Example project that include all sources while calculating coverage with gulp and karma
https://github.com/J-Sek/example-gulp-karma-include-all.git
Example project using Require.js and file path patterns. Prooving it is possible to get 0% coverage and not worry about confliciting implementations.
Note: you don't need to use Require.js across the solution.
npm install
Run:
npm test
or:
gulp coverage
compare with:
gulp coverage_tested
{pattern: 'Scripts/App/**/*.js', included: false},
{pattern: 'Scripts/Test/**/*Spec.js', included: false},
var tests = [];
for (var file in window.__karma__.files) {
if (/Spec\.js$/.test(file)) {
tests.push(file);
}
}
require(['/base/Scripts/App/Calc.js']);
requirejs.config({
deps: tests,
callback: window.__karma__.start
});
coverageReporter: {
includeAllSources: true,
...
}