spalger / gulp-jshint

JSHint plugin for gulp
MIT License
419 stars 65 forks source link

Fix fail reporter #114

Closed Slayer95 closed 9 years ago

Slayer95 commented 9 years ago

JSHint 2.8.0 made this bug apparent.

Slayer95 commented 9 years ago

@spalger

spalger commented 9 years ago

Sorry for neglecting this @Slayer95. Can you add a test case for this please?

Slayer95 commented 9 years ago

Well, as I mentioned before, there were 2 tests failing before this. Unfortunately, I am not familiar enough with the JSHint results, but theoretically an additional test could be written like this.

Fixture

myfixture.js
// JSHint reports N errors, 0 warnings, 0 info, for N > 0
// both using JSHint 2.7.0 and 2.8.0.
// In particular, before and after https://github.com/jugglinmike/jshint/commit/a093f784ee5298973c6233e9113842cbe8d16c74

Test

it('should not require warnings to fail', function () {
    var fakeFile = new Fixture('myfixture');

    var stream = jshint();
    var failStream = jshint.reporter('fail');
    stream.pipe(failStream);

    failStream.on('error', function (err) {
      should.exist(err);
      err.message.indexOf(fakeFile.relative).should.not.equal(-1, 'should say which file');
      done();
    });

    stream.write(fakeFile);
    stream.end();
});