diff --git a/test/integration/fixtures/options/allow-uncaught/within-runner.fixture.js b/test/integration/fixtures/options/allow-uncaught/within-runner.fixture.js new file mode 100644 index 0000000000..ebdd3facd7 --- /dev/null +++ b/test/integration/fixtures/options/allow-uncaught/within-runner.fixture.js @@ -0,0 +1,12 @@ +'use strict'; + +describe('Uncaught exception within runner', () => { + it('test1', () => { + setTimeout(() => { + throw new Error('Uncaught error after test1'); + }, 1); + }); + it('test2', function () { }); + it('test3', function () { }); + it('test4', function () { }); +}); \ No newline at end of file diff --git a/test/integration/options/allowUncaught.spec.js b/test/integration/options/allowUncaught.spec.js index a3d8739ffe..50724771f3 100644 --- a/test/integration/options/allowUncaught.spec.js +++ b/test/integration/options/allowUncaught.spec.js @@ -2,11 +2,32 @@ var path = require('path').posix; var helpers = require('../helpers'); +var runMocha = helpers.runMocha; var runMochaJSON = helpers.runMochaJSON; describe('--allow-uncaught', function() { var args = ['--allow-uncaught']; + it('should throw an uncaught error within runner', function(done) { + var fixture = path.join('options', 'allow-uncaught', 'within-runner'); + runMocha( + fixture, + args, + function(err, res) { + if (err) { + return done(err); + } + + expect(res.code, 'to be greater than', 0); + expect(res.output, 'to contain', 'Uncaught error after test1'); + expect(res.passing, 'to be', 0); + expect(res.failing, 'to be', 0); + done(); + }, + {stdio: 'pipe'} + ); + }); + it('should run with conditional `this.skip()`', function(done) { var fixture = path.join('options', 'allow-uncaught', 'this-skip-it'); runMochaJSON(fixture, args, function(err, res) {