Skip to content

Commit

Permalink
additional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Oct 8, 2019
1 parent 31e8cec commit 9743cb5
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
@@ -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
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 9743cb5

Please sign in to comment.