blob: 46411fc18bc945521e370d7a11f5f5b5471befd0 (
plain)
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
|
var Mocha = require('../');
var Test = Mocha.Test;
describe('Mocha', function(){
var blankOpts = { reporter: function(){} }; // no output
describe('.run(fn)', function(){
it('should not raise errors if callback was not provided', function(){
var mocha = new Mocha(blankOpts);
mocha.run();
})
it('should execute the callback when complete', function(done) {
var mocha = new Mocha(blankOpts);
mocha.run(function(){
done();
})
})
it('should execute the callback with the number of failures '+
'as parameter', function(done) {
var mocha = new Mocha(blankOpts);
var failingTest = new Test('failing test', function(){
throw new Error('such fail');
});
mocha.suite.addTest(failingTest);
mocha.run(function(failures) {
failures.should.equal(1);
done();
});
})
})
})
|