1

I'm running some tests with mochajs.

var Mocha = require('mocha');
var mocha = new Mocha();
mocha.addFile('mocha/0000_1234.js');
mocha.addFile('mocha/0010_5678.js');

mocha.run(function(failures){
...

Is there an option like "Stop on Error"? I want to stop my tests, when the first error happen.

powerpete
  • 2,663
  • 2
  • 23
  • 49

1 Answers1

3

There is bail option:

bail after first test failure

To set this option, use mocha#setup method:

mocha.setup({
  bail: true
});

Mocha docs

alexmac
  • 19,087
  • 7
  • 58
  • 69