diff --git a/test/integration/fixtures/require-undefined.fixture.js b/test/integration/fixtures/require-undefined.fixture.js new file mode 100644 index 0000000000..3afbeab5ba --- /dev/null +++ b/test/integration/fixtures/require-undefined.fixture.js @@ -0,0 +1,11 @@ +// this generic fixture does nothing special and will be used if no fixture is supplied + +'use strict'; + +var assert = require('assert'); + +describe('a suite', function() { + it('should succeed', function() { + assert(false); + }); +}); diff --git a/test/integration/options/failOnFailingTestSuite.spec.js b/test/integration/options/failOnFailingTestSuite.spec.js new file mode 100644 index 0000000000..7834ef693b --- /dev/null +++ b/test/integration/options/failOnFailingTestSuite.spec.js @@ -0,0 +1,22 @@ +'use strict'; + +var helpers = require('../helpers'); +var runMochaJSON = helpers.runMochaJSON; + +describe('--fail-on-failing-test-suite', function() { + var args = ['--fail-on-failing-test-suite=false']; + + it('should success', function(done) { + var fixture = 'require-undefined.fixture.js'; + runMochaJSON(fixture, args, function(err, res) { + if (err) { + return done(err); + } + + expect(res, 'to have passed test count', 0) + .and('to have test count', 1) + .and('to have exit code', 0); + done(); + }); + }); +}); diff --git a/test/unit/mocha.spec.js b/test/unit/mocha.spec.js index 2275a2e58c..41689b2c0c 100644 --- a/test/unit/mocha.spec.js +++ b/test/unit/mocha.spec.js @@ -376,6 +376,28 @@ describe('Mocha', function() { }); }); + describe('failOnFailingTestSuite()', function() { + it('should set the failOnFailingTestSuite option to true', function() { + mocha.failOnFailingTestSuite(); + expect( + mocha.options, + 'to have property', + 'failOnFailingTestSuite', + true + ); + }); + + it('should set the failOnFailingTestSuite option to false', function() { + mocha.failOnFailingTestSuite(false); + expect( + mocha.options, + 'to have property', + 'failOnFailingTestSuite', + false + ); + }); + }); + describe('failZero()', function() { it('should set the failZero option to true', function() { mocha.failZero();