blob: 618742cdbd47bb052fe4fc26a8d18a67cc2b8a3c (
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
34
35
|
'use strict';
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();
});
});
});
});
|