Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
juergba committed Jan 16, 2020
1 parent 085de5c commit a8a635b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/unit/runner.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var path = require('path');
var sinon = require('sinon');
var Mocha = require('../../lib/mocha');
var Pending = require('../../lib/pending');
var Suite = Mocha.Suite;
var Runner = Mocha.Runner;
var Test = Mocha.Test;
Expand Down Expand Up @@ -690,6 +691,20 @@ describe('Runner', function() {
sandbox.stub(runner, 'fail');
});

describe('when allow-uncaught is set to true', function() {
it('should propagate error and throw', function() {
var err = new Error('should rethrow err');
runner.allowUncaught = true;
expect(
function() {
runner.uncaught(err);
},
'to throw',
'should rethrow err'
);
});
});

describe('when provided an object argument', function() {
describe('when argument is not an Error', function() {
var err;
Expand All @@ -713,6 +728,13 @@ describe('Runner', function() {
});
});

describe('when argument is a Pending', function() {
it('should ignore argument and return', function() {
var err = new Pending();
expect(runner.uncaught(err), 'to equal', undefined);
});
});

describe('when argument is an Error', function() {
var err;
beforeEach(function() {
Expand Down

0 comments on commit a8a635b

Please sign in to comment.