Tuesday, 1 September 2015

CI with VS Code 2015 - Gulp with a grunt!


Grunting was pretty easy compared to gulp although everybody would tell you otherwise - by everybody, I mean the really knowledgeable ones, that is - the reason being a gulp error that does not seem to resolve except by leaving an ugly footprint in the output.

Grunt was simple - all tasks happening right there while gulp uses 'pipes' making it faster than grunt but leaving the error handling part difficult. This means a failing test reported by mocha would result in an unhandled error !

But where there is a problem there should be a solution, this is the world of logic, right?

The solution is to invoke a grunt task from gulp ! :D

In the gruntfile.js is the 'execute' task 

which I invoke from the gulpfile.js !

To make it clearer, change the gulp.start from 'execute' in the gulpfile to 'grunt-mochaTest':

So, now, instead of the ugly message, you have a warning message, which, too, disappears if all tests pass as below:

To make this integration happen between grunt and gulp, you need the 'gulp-grunt' package. npm install it and happy gulping with a grunt!

No comments: