travis-ci
1824 of 1915 branches covered (95.25%)
3267 of 3333 relevant lines covered (98.02%)
2741.33 hits per line
1 |
const Promise = require('unexpected-bluebird');
|
15✔ |
2 |
|
|
3 |
const workQueue = { |
15✔ |
4 |
queue: [],
|
|
5 |
drain() { |
|
6 |
this.queue.forEach(fn => {
|
14,080✔ |
7 |
fn(); |
6,509✔ |
8 |
}); |
|
9 |
this.queue = [];
|
14,080✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
const scheduler = Promise.setScheduler(fn => { |
15✔ |
14 |
workQueue.queue.push(fn); |
6,400✔ |
15 |
scheduler(() => { |
6,400✔ |
16 |
workQueue.drain(); |
6,400✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
20 |
Promise.prototype._notifyUnhandledRejection = function() { |
15✔ |
21 |
const that = this;
|
2,180✔ |
22 |
scheduler(() => { |
2,180✔ |
23 |
if (that._isRejectionUnhandled()) {
|
|
24 |
if (workQueue.onUnhandledRejection) {
|
|
25 |
// for testing
|
|
26 |
workQueue.onUnhandledRejection(that.reason()); |
× |
27 |
} else {
|
|
28 |
throw that.reason();
|
1✔ |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
15✔ |