diff options
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/mocha.spec.js')
-rw-r--r-- | tests/lib/mocha-3.1.0/test/mocha.spec.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/test/mocha.spec.js b/tests/lib/mocha-3.1.0/test/mocha.spec.js new file mode 100644 index 0000000000..46411fc18b --- /dev/null +++ b/tests/lib/mocha-3.1.0/test/mocha.spec.js @@ -0,0 +1,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(); + }); + }) + }) +}) |