push
travis-ci
1761 of 1847 branches covered (95.34%)
3280 of 3339 relevant lines covered (98.23%)
15108.8 hits per line
1 |
var Promise = require('unexpected-bluebird'); |
90✔ |
2 |
|
|
3 |
var workQueue = {
|
90✔ |
4 |
queue: [],
|
|
5 |
drain: function () { |
|
6 |
this.queue.forEach(function (fn) { |
77,887✔ |
7 |
fn(); |
35,966✔ |
8 |
}); |
|
9 |
this.queue = [];
|
77,887✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
var scheduler = Promise.setScheduler(function (fn) { |
90✔ |
14 |
workQueue.queue.push(fn); |
35,312✔ |
15 |
scheduler(function () {
|
35,312✔ |
16 |
workQueue.drain(); |
35,306✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
20 |
|
|
21 |
Promise.prototype._notifyUnhandledRejection = function () { |
90✔ |
22 |
var that = this; |
10,974✔ |
23 |
scheduler(function () {
|
10,974✔ |
24 |
if (that._isRejectionUnhandled()) {
|
|
25 |
if (workQueue.onUnhandledRejection) { // for testing |
|
26 |
workQueue.onUnhandledRejection(that.reason()); |
6✔ |
27 |
} else {
|
|
28 |
throw that.reason();
|
× |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
90✔ |