Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js')
-rw-r--r--tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js b/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js
new file mode 100644
index 0000000000..87dde90902
--- /dev/null
+++ b/tests/lib/mocha-3.1.0/test/integration/uncaught.spec.js
@@ -0,0 +1,35 @@
+var assert = require('assert');
+var run = require('./helpers').runMochaJSON;
+var args = [];
+
+describe('uncaught exceptions', function() {
+ it('handles uncaught exceptions from hooks', function(done) {
+ run('uncaught-hook.fixture.js', args, function(err, res) {
+ assert(!err);
+ assert.equal(res.stats.pending, 0);
+ assert.equal(res.stats.passes, 0);
+ assert.equal(res.stats.failures, 1);
+
+ assert.equal(res.failures[0].fullTitle,
+ 'uncaught "before each" hook');
+ assert.equal(res.code, 1);
+ done();
+ });
+ });
+
+ it('handles uncaught exceptions from async specs', function(done) {
+ run('uncaught.fixture.js', args, function(err, res) {
+ assert(!err);
+ assert.equal(res.stats.pending, 0);
+ assert.equal(res.stats.passes, 0);
+ assert.equal(res.stats.failures, 2);
+
+ assert.equal(res.failures[0].title,
+ 'fails exactly once when a global error is thrown first');
+ assert.equal(res.failures[1].title,
+ 'fails exactly once when a global error is thrown second');
+ assert.equal(res.code, 2);
+ done();
+ });
+ });
+});