/
allowUncaught.spec.js
46 lines (40 loc) · 1.28 KB
/
allowUncaught.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
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 and exit process', function(done) {
var fixture = path.join('options', 'allow-uncaught', 'propagate');
runMocha(
fixture,
args,
function(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be greater than', 0);
expect(res.output, 'to contain', 'Error: 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) {
if (err) {
return done(err);
}
expect(res, 'to have passed')
.and('to have passed test count', 2)
.and('to have pending test count', 3)
.and('to have passed test', 'test1', 'test4')
.and('to have pending test order', 'test2', 'test3', 'test5');
done();
});
});
});