I didn't find any good solutions searching around for "gulp jest testing", so I'm going to write up what I did.
Solution
var gulp = require('gulp');
var gutil = require('gulp-util');
var jest = require('jest-cli');
var chalk = require('chalk');
gulp.task('test:jest', function (callback) {
var onComplete = function (result) {
if (result) {
} else {
console.log(chalk.bgRed('!!! Jest tests failed! You should fix them soon. !!!'));
}
callback();
}
jest.runCLI({}, __dirname, onComplete);
});
Call for critique
Is there even a need to use jest-cli? Is there a simpler way I should do this? I only figured this out from reading jest-cli source code, since there's basically no documentation I found on the actual Jest docs site (or the README on Github).
Reference
I have a silly project on GitHub for basic React stuff that I continually slowly update. Check it out if you please: https://github.com/kimagure/ShowTrackerReact