| 1 |
'use strict'; |
| 2 |
const assert = require('assert'); |
| 3 |
|
| 4 |
describe('uncaught', function() { |
| 5 |
var hookOrder = []; |
| 6 |
it('throw delayed error', (done) => { |
| 7 |
setTimeout(() => { |
| 8 |
throw new Error('Whoops!'); |
| 9 |
}, 10) |
| 10 |
setTimeout(done, 10); |
| 11 |
}); |
| 12 |
it('should wait 15ms', (done) => { |
| 13 |
setTimeout(done, 15); |
| 14 |
}); |
| 15 |
it('test 3', () => { }); |
| 16 |
|
| 17 |
afterEach(function() { |
| 18 |
hookOrder.push(this.currentTest.title); |
| 19 |
}); |
| 20 |
after(function() { |
| 21 |
hookOrder.push('after'); |
| 22 |
assert.deepEqual( |
| 23 |
hookOrder, |
| 24 |
['throw delayed error', 'should wait 15ms', 'test 3', 'after'] |
| 25 |
); |
| 26 |
throw new Error('should get upto here and throw'); |
| 27 |
}); |
| 28 |
}); |