Skip to content

Commit

Permalink
Add instantly failing reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold committed Oct 4, 2014
1 parent 1ef3dd2 commit 613ebc7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions src/reporters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');
Expand Down
11 changes: 11 additions & 0 deletions src/reporters/instafail.js
Original file line number Diff line number Diff line change
@@ -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);
}
});
};

0 comments on commit 613ebc7

Please sign in to comment.