简体   繁体   中英

How to generate coverage report through gulp task in Angular 4?

I have tried so many plugins for writing gulp task to generate coverage report in Angular 4 but no-one was working. All documentation is for javascript files and in angular 4 we have typescript files. Once I tried converting all my ts files to js files using gulp typescript and then passed those javascript references in gulp source, but finally it ends with errors.

Is there any plugin for angular 2+ to generate coverage report through gulp?

Thank you!

I found one solution for that using gulp-exec.

In gulp-exec we can run any command.

https://www.npmjs.com/package/gulp-exec

var exec = require('child_process').exec;

gulp.task('task', function (cb) {
  exec('ng test -cc', function (err, stdout, stderr) {
    console.log(stdout);
    console.log(stderr);
    cb(err);
  });
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM