push
travis-ci
1777 of 1865 branches covered (95.28%)
3212 of 3212 new or added lines in 20 files covered. (100.0%)
3193 of 3253 relevant lines covered (98.16%)
2506.28 hits per line
|
const Promise = require('unexpected-bluebird');
|
15✔ |
2 |
|
|
|
const workQueue = { |
15✔ |
4 |
queue: [],
|
|
5 |
drain() { |
|
|
this.queue.forEach(fn => {
|
12,999✔ |
|
fn(); |
6,003✔ |
8 |
}); |
|
|
this.queue = [];
|
12,999✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
|
const scheduler = Promise.setScheduler(fn => { |
15✔ |
|
workQueue.queue.push(fn); |
5,894✔ |
|
scheduler(() => { |
5,894✔ |
|
workQueue.drain(); |
5,894✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
|
Promise.prototype._notifyUnhandledRejection = function() { |
15✔ |
|
const that = this;
|
1,835✔ |
|
scheduler(() => { |
1,835✔ |
|
if (that._isRejectionUnhandled()) {
|
|
|
if (workQueue.onUnhandledRejection) {
|
|
25 |
// for testing
|
|
|
workQueue.onUnhandledRejection(that.reason()); |
1✔ |
27 |
} else {
|
|
|
throw that.reason();
|
× |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
15✔ |