blob: 054d1d857bf951133c3d5dfa35b5aa6392dc603e (
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
|
'use strict';
/**
* This file should only generate one failure per spec despite the fact that
* Mocha is capable of detecting two distinct exceptions during test execution.
*/
it('fails exactly once when a global error is thrown first', function(done) {
setTimeout(function() {
throw new Error('global error');
setTimeout(function() {
done(new Error('test error'));
}, 0);
}, 0);
});
it('fails exactly once when a global error is thrown second', function(done) {
setTimeout(function() {
done(new Error('test error'));
}, 0);
setTimeout(function() {
throw new Error('global error');
}, 0);
});
|