Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Sep 28, 2019
1 parent fa03b80 commit f6780d7
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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 () { });
});
21 changes: 21 additions & 0 deletions test/integration/options/allowUncaught.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f6780d7

Please sign in to comment.