I'm getting empty coverage report
Please find my gulpfile.js
var gulp=require('gulp');
gulp.task('hello',function(){
console.log("Hello");
});
var tsc=require('gulp-typescript');
var Server = require('karma').Server;
var tsProjects=tsc.createProject('tsConfig.json');
var open = require('gulp-open');
/*
* Run test once and exit
*/
gulp.task('test', function (done) {
return new Server({
configFile: __dirname + '/karma.conf.js',
action: 'run',
singleRun: true,
preprocessors: {
'src/app/accordion/*.js': ['coverage']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
type : 'html',
dir : 'coverage/',
subdir: '.'
}
}, done).on('error', function(err) {
throw err;
}).start();
});
gulp.task('compile-ts',function(){
var sourceTsFiles=[
'./src/app/**/*.ts','./typings/**/*.d.ts'
]
var tsResult=gulp.src(sourceTsFiles)
.pipe(tsc(tsProjects));
return tsResult.js
.pipe(gulp.dest('./src/app/'));
});
gulp.task('coverage', ['test'], function() {
return gulp.src('./coverage/js/index.html')
.pipe(open());
});
After doing this I'm not getting any error when run using command 'gulp coverage'
Before adding coverage task in code It was running all the test cases with only test task. But after adding coverage task its not even running test cases so getting empty coverage report. But in the report I'm getting empty data
Please let me know what's wrong with the coverage task. Thanks in advance.