Mocha: Is there a way to make mocha to not stop on first error?

Created on 25 Feb 2016  Â·  2Comments  Â·  Source: mochajs/mocha

Mocha crashed when reporting errors:

describe ( 'test', function () {
it ( '#asyncCall()', function ( done ) {
someAsyncCall ( function ( err ) {
done ( err ? new Error ( err + '' ) : null );
});
});
});

Most helpful comment

use the --bail option

All 2 comments

Sorry, I don't think this is an issue with mocha!

describe('suite', function() {
  it('test', function(done) {
    setTimeout(function() {
      done(new Error('foo'));
    });
  });

  it('test2', function() {});
});
$ mocha example.js


  suite
    1) test
    ✓ test2


  1 passing (13ms)
  1 failing

  1) suite test:
     Error: foo
      at null._onTimeout (example.js:4:12)

use the --bail option

Was this page helpful?
0 / 5 - 0 ratings