Skip to content
New issue

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

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

Already on GitHub? # to your account

Gulp goesn’t use exit code 1 on Mocha errors #45

Closed
ai opened this issue Jul 9, 2014 · 4 comments · Fixed by #57
Closed

Gulp goesn’t use exit code 1 on Mocha errors #45

ai opened this issue Jul 9, 2014 · 4 comments · Fixed by #57

Comments

@ai
Copy link
Contributor

ai commented Jul 9, 2014

I use gulp-mocha 0.5.0 have task:

gulp.task('test', function () {
    require('./');
    var mocha = require('gulp-mocha');

    return gulp.src('test/*.js', { read: false })
        .pipe(mocha());
});

When I start task, I have mocha failed tests, but exit code is 0:

postcss → n gulp test
[01:26:51] Using gulpfile ~/Dev/postcss/gulpfile.js
[01:26:51] Starting 'test'...

  [01:26:52] Finished 'test' after 671 ms
․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․․
  ․․․․․․․․․․․․․․

  189 passing (198ms)
  4 failing

  1) source maps changes previous source map:

      AssertionError: expected { source: '/a.css', line: 1, column: 4, name: null } to equal { source: 'a.css', line: 1, column: 4, name: null }
      + expected - actual

       {
         "column": 4,
         "line": 1,
         "name": null,
      +  "source": "a.css"
      -  "source": "/a.css"
       }

      at Assertion.prop.(anonymous function) [as eql] (/home/ai/Dev/postcss/node_modules/should/lib/should.js:61:14)
      at Context.css (/home/ai/Dev/postcss/test/map.js:95:17)
      at callFn (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:373:10)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:451:12
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:298:14)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:308:7
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:275:5)

  2) source maps uses map from subdir:

      AssertionError: expected '/a.css' to equal '../../a.css'
      + expected - actual

      +"../../a.css"
      -"/a.css"

      at Assertion.prop.(anonymous function) [as eql] (/home/ai/Dev/postcss/node_modules/should/lib/should.js:61:14)
      at Context.$__0.doubler.process.from (/home/ai/Dev/postcss/test/map.js:260:24)
      at callFn (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:373:10)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:451:12
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:298:14)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:308:7
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:275:5)

  3) source maps works with different types of maps:

      AssertionError: expected '/a.css' to equal 'a.css'
      + expected - actual

      +"a.css"
      -"/a.css"

      at Assertion.prop.(anonymous function) [as eql] (/home/ai/Dev/postcss/node_modules/should/lib/should.js:61:14)
      at Context.$__0.doubler.process.from (/home/ai/Dev/postcss/test/map.js:319:28)
      at callFn (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:373:10)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:451:12
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:298:14)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:308:7
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:275:5)

  4) source maps miss source content on request:
     Error: "../a.css" is not in the SourceMap.
      at SourceMapConsumer_sourceContentFor [as sourceContentFor] (/home/ai/Dev/postcss/node_modules/source-map/lib/source-map/source-map-consumer.js:375:13)
      at Context.<anonymous> (/home/ai/Dev/postcss/test/map.js:364:29)
      at callFn (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:223:21)
      at Test.Runnable.run (/home/ai/Dev/postcss/node_modules/mocha/lib/runnable.js:216:7)
      at Runner.runTest (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:373:10)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:451:12
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:298:14)
      at /home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:308:7
      at next (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:246:23)
      at Object._onImmediate (/home/ai/Dev/postcss/node_modules/mocha/lib/runner.js:275:5)

postcss →

Travis CI also get exit code 0: https://travis-ci.org/ai/postcss/builds/29471330

@floatdrop
Copy link
Contributor

This issue belongs to gulp itself - see this issue gulpjs/gulp#479

You can add .on('error', process.exit.bind(process, 1)) as workaround.

@ai
Copy link
Contributor Author

ai commented Jul 9, 2014

@floatdrop but when I return gutil.PluginError in another plugins, everything does good (exit status 1).

@wbyoung
Copy link

wbyoung commented Jul 22, 2014

+1. gulp-karma seems to somehow exit with the right status.

@superbrothers
Copy link

+1

Repository owner locked and limited conversation to collaborators Aug 22, 2014
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants