More time coding. Less switching windows. - 1 minute read

Gulp has come through for me.  Here's a gulpfile that will save you some time toggling back and forth between your IDE and the command line:



const gulp = require('gulp');
const cp = require('child_process');

gulp.task('runTestsOnChange', function runTestsOnChange() {
gulp.watch(['**/*.js'], function() {
console.log('change detected');
try {
cp.execSync('jasmine',{
//set current directory to the child process' current working directory
cwd: __dirname,
//the child process will use the parent's stdin, stdout and stderr streams
stdio: [0,1,2]});
} catch (error) {
console.log('Looks like your tests did not pass. No worries. Keep working!');
}
});
// gulp.watch(['**/*.js'], ['jasmine']);
});

gulp.task('default',['runTestsOnChange']);

Comments

Popular posts from this blog

Optional object property access

A short guide to cross-site request forgery attacks

How is an application like a bride's outfit? - 1 minute read