diff --git a/src/index.js b/src/index.js index ff79946..725a9b0 100644 --- a/src/index.js +++ b/src/index.js @@ -23,6 +23,7 @@ var jshintPlugin = function (opt) { // expose the reporters jshintPlugin.failReporter = reporters.fail; +jshintPlugin.instafailReporter = reporters.instafail; jshintPlugin.loadReporter = reporters.loadReporter; jshintPlugin.reporter = reporters.reporter; diff --git a/src/reporters/index.js b/src/reporters/index.js index a611f42..9ffd5b6 100644 --- a/src/reporters/index.js +++ b/src/reporters/index.js @@ -2,7 +2,8 @@ var PluginError = require('gulp-util').PluginError; var stream = require('../stream'); var _ = require('lodash'); -exports.failReporter = require('./fail'); +exports.fail = require('./fail'); +exports.instafail = require('./instafail'); exports.loadReporter = function (reporter) { // we want the function @@ -30,7 +31,7 @@ exports.reporter = function (reporter, reporterCfg) { reporterCfg = reporterCfg || {}; if (reporter === 'fail') { - return exports.failReporter(reporterCfg); + return exports.fail(reporterCfg); } var rpt = exports.loadReporter(reporter || 'default'); diff --git a/src/reporters/instafail.js b/src/reporters/instafail.js new file mode 100644 index 0000000..d91d550 --- /dev/null +++ b/src/reporters/instafail.js @@ -0,0 +1,11 @@ +var through = require("through2"); + +module.exports = function () { + return through.obj(function (file, _, callback) { + if (file.jshint.success) { + callback(null, file); + } else { + process.exit(1); + } + }); +};