travis-ci
3143 of 3208 relevant lines covered (97.97%)
12860.98 hits per line
1 |
var Promise = require('unexpected-bluebird'); |
75✔ |
2 |
|
|
3 |
var workQueue = {
|
75✔ |
4 |
queue: [],
|
|
5 |
drain: function () { |
|
6 |
this.queue.forEach(function (fn) { |
61,798✔ |
7 |
fn(); |
28,410✔ |
8 |
}); |
|
9 |
this.queue = [];
|
61,798✔ |
10 |
} |
|
11 |
}; |
|
12 |
|
|
13 |
var scheduler = Promise.setScheduler(function (fn) { |
75✔ |
14 |
workQueue.queue.push(fn); |
27,865✔ |
15 |
scheduler(function () {
|
27,865✔ |
16 |
workQueue.drain(); |
27,860✔ |
17 |
}); |
|
18 |
}); |
|
19 |
|
|
20 |
|
|
21 |
Promise.prototype._notifyUnhandledRejection = function () { |
75✔ |
22 |
var that = this; |
8,770✔ |
23 |
scheduler(function () {
|
8,770✔ |
24 |
if (that._isRejectionUnhandled()) {
|
8,755✔ |
25 |
if (workQueue.onUnhandledRejection) { // for testing |
5✔ |
26 |
workQueue.onUnhandledRejection(that.reason()); |
5✔ |
27 |
} else {
|
|
28 |
throw that.reason();
|
× |
29 |
} |
|
30 |
} |
|
31 |
}); |
|
32 |
}; |
|
33 |
|
|
34 |
module.exports = workQueue; |
75✔ |