Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instantly failing reporter #81

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sdepold
Copy link

@sdepold sdepold commented Oct 4, 2014

This PR

  • adds another reporter which instantly fails after executing jshint.
  • fixes jshint.failReporter which was undefined before.
  • has been provided because of the following caveat:

My gulpfile looks like this:

gulp.task("default", ["lint", "test"], function () {});
gulp.task('lint', function () {
  gulp
    .src([ /* sources */ ])
    .pipe(jshint())
    .pipe(jshint.reporter(require("jshint-stylish")))
    .pipe(jshint.failReporter());
});

gulp.task("test", function () {
  gulp
    .src(path.resolve(__dirname, "test", "**", "*.test.js"), { read: false })
    .pipe(mocha());
});

When I have a linting issue and run the default task, it results in this:

npm test

> [email protected] test /Users/sdepold/Projects/sequelize/cli
> gulp

[12:16:41] Using gulpfile ~/Projects/sequelize/cli/gulpfile.js
[12:16:41] Starting 'lint'...
[12:16:41] Finished 'lint' after 15 ms
[12:16:41] Starting 'test'...
[12:16:41] Finished 'test' after 1.5 ms
[12:16:41] Starting 'default'...
[12:16:41] Finished 'default' after 4.44 μs

/Users/sdepold/Projects/sequelize/cli/gulpfile.js
  line 11  col 17  Strings must use doublequote.

  ⚠  1 warning



  [MYSQL] bin/sequelize help
EventEmitter#success|ok is deprecated, please use promise-style instead.
EventEmitter#failure|fail|error is deprecated, please use promise-style instead.
    1) prints the help

  [MYSQL] bin/sequelize h

... some other output from the test task ...

events.js:72
        throw er; // Unhandled 'error' event

I have honestly no idea why the test task is actually still executed, but apparently the fail reporter does not kill the process but emits an error event which gets delayed until a certain amount of time passes.

Having instafail in place, it looks like this:

//gulpfile:
    .pipe(jshint())
    .pipe(jshint.reporter(require("jshint-stylish")))
    .pipe(jshint.instafailReporter());

And the gulp run:

npm test

> [email protected] test /Users/sdepold/Projects/sequelize/cli
> gulp

[12:21:09] Using gulpfile ~/Projects/sequelize/cli/gulpfile.js
[12:21:09] Starting 'lint'...
[12:21:09] Finished 'lint' after 17 ms
[12:21:09] Starting 'test'...
[12:21:09] Finished 'test' after 1.59 ms
[12:21:09] Starting 'default'...
[12:21:09] Finished 'default' after 4.36 μs

/Users/sdepold/Projects/sequelize/cli/gulpfile.js
  line 11  col 17  Strings must use doublequote.

  ⚠  1 warning

npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0

@sdepold sdepold force-pushed the feature/instafail branch from 613ebc7 to 99b9ace Compare October 4, 2014 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant