push
travis-ci
1765 of 1851 branches covered (95.35%)
3282 of 3341 relevant lines covered (98.23%)
15139.36 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,991✔ |
7 |
fn(); |
36,018✔ |
8 |
}); |
|
9 |
this.queue = [];
|
77,991✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
var scheduler = Promise.setScheduler(function (fn) { |
90✔ |
14 |
workQueue.queue.push(fn); |
35,364✔ |
15 |
scheduler(function () {
|
35,364✔ |
16 |
workQueue.drain(); |
35,358✔ |
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✔ |