| 1 |
'use strict'; |
| 2 |
|
| 3 |
/** |
| 4 |
* This file should generate only one failure per spec for the thrown error. |
| 5 |
* It should not report misleading 'multiple calls to done()'. |
| 6 |
*/ |
| 7 |
|
| 8 |
it('fails exactly once when a global error is thrown synchronously and done errors', function (done) { |
| 9 |
setTimeout(function () { |
| 10 |
done(new Error('test error')); |
| 11 |
}, 1); // Not 0 - it will 'succeed', but won't test the breaking condition |
| 12 |
|
| 13 |
throw new Error('sync error a'); |
| 14 |
}); |
| 15 |
|
| 16 |
it('fails exactly once when a global error is thrown synchronously and done completes', function (done) { |
| 17 |
setTimeout(function () { |
| 18 |
done(); |
| 19 |
}, 1); // Not 0 - it will 'succeed', but won't test the breaking condition |
| 20 |
|
| 21 |
throw new Error('sync error b'); |
| 22 |
}); |